This method searches for an object at a certain x,y position.
Declaration
IWPTextObj IWPTextObj GetObjAtXY([In] int X, [In] int Y, [In] int TypeMask, [In] int Mode);
Description
The Result is a reference to the IWPTextObj interface. If no object was found the result will be null.
This code locates the hyperlink at the mouse position:
private void wpdllInt1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { IWPMemo Memo = wpdllInt1.CurrMemo; IWPTextObj obj = Memo.GetObjAtXY(e.X, e.Y, 0, 2); } |
Parameters |
X |
The horizontal position |
Y |
The vertical position |
TypeMask |
Selects the object types to find: 0=automatic, find nearest object or the object at this position. 1..13=values as defined by enum "TextObjTypes". ie: 1=merge field, 2=hyperlink, 3=bookmark, 7=text object such as page number, 12=image object. |
Mode |
Selects the way the X and Y parameter is expected: -1: Dont use X and Y parameter. Use current mouse position instead. 0 : X and Y are client coordinates of the editor. If you use the method in OnMouseDown or OnMouseMove use this mode. 1 : X and Y are coordinates relative to upper left corner of edit control (including the toolbars) 2 : X and Y are screen coordinates (relative to desktop) |
Category