ConvertPtToView(Pt: IGxPoint): IGxPointF;
Pt - screen point coordinates, by which it is necessary to get workspace coordinates.
The ConvertPtToView method enables the user to get workspace point coordinates using screen point coordinates.
Executing the example requires a form with the WorkspaceBox component named WorkspaceBox1 and the UiWorkspaceObject component or the UiWorkspace component that is a data source for WorkspaceBox1.
Sub WorkspaceBox1OnMouseDown(Sender: Object; Args: IMouseClickEventArgs);
Var
Pt: IGxPoint;
PtF: IGxPointF;
x, y: Double;
Begin
Pt := Args.pPoint As IGxPoint;
PtF := WorkspaceBox1.ConvertPtToView(Pt);
x := PtF.X;
y := PtF.Y;
End Sub WorkspaceBox1OnMouseDown;
After executing the example, if the user points the cursor at the workspace and clicks the mouse button, the "x" and "y" variables contain the workspace coordinates that were obtained using mouse cursor screen coordinates transformation.
See also: