TerPixToTextPos
Retrieve the text position at a given pixel position.
bool TerPixToTextPos( RelativeTo, x, y, out pLine, ref pCol)
int RelativeTo; | This parameter should be set to one of the following constants: |
| REL_SCREEN: | When specifying the x/y values relative to the top of the screen. |
| REL_WINDOW: | When specifying the x/y values relative to the client area of the edit control. |
| REL_TEXT_BOX: | When specifying the x/y values relative to the top of the text box. |
int x; | The x position of the pixel. |
int y; | The y position of the pixel. |
int pLine; | The variable to receive the text line number. |
int pCol; | The variable to receive the text column number. To retrieve the absolute text position in the pLine parameter, set the pCol parameter to null or set the column number to -1. |
Return Value: This function returns true when successful.
Example: The example below retrieves the text position at a pixel position x=100, y=100.
int line;
int col=0; // set to 0 to retrieve the position in line/column format.
TerPixToTextPos( REL_TEXT_BOX, 100, 100, out line, ref col);