Share via


IDWriteTextLayout::HitTestTextPosition Method

The application calls this function to get the pixel location relative to the top-left of the layout box given the text position and the logical side of the position. This function is normally used as part of caret positioning of text where the caret is drawn at the location corresponding to the current text editing position. It may also be used as a way to programmatically obtain the geometry of a particular text position in UI automation.

Syntax

virtual HRESULT HitTestTextPosition(
  UINT32  textPosition,
  BOOL  isTrailingHit,
  [out]  FLOAT * pointX,
  [out]  FLOAT * pointY,
  [out]  DWRITE_HIT_TEST_METRICS * hitTestMetrics
) = 0;

Parameter

  • textPosition
    The text position used to get the pixel location.

  • isTrailingHit
    A Boolean flag that indicates whether the pixel location is of the leading or the trailing side of the specified text position.

  • pointX [out]
    When this method returns, contains the output pixel location X, relative to the top-left location of the layout box.

  • pointY [out]
    When this method returns, contains the output pixel location Y, relative to the top-left location of the layout box.

  • hitTestMetrics [out]
    When this method returns, contains the output geometry fully enclosing the specified text position.

Rückgabewert

Ist Methode erfolgreich, wird "S_OK" zurückgegeben. Andernfalls wird ein HRESULT-Fehlercode zurückgegeben.

Anforderungen

Mindestens unterstützter Client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista

Mindestens unterstützter Server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008

Header

Dwrite.h

Bibliothek

Dwrite.lib

DLL

Dwrite.dll

Siehe auch

IDWriteTextLayout