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, the WorkspaceBox component named WorkspaceBox1 on the form and the UiWorkspaceObject, or UiWorkspace component that is a data source for the WorkspaceBox1 component.
Add links to the Andy, ExtCtrls, Forms, Ui, and Workspace system assemblies.
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 will contain the workspace coordinates obtained using mouse cursor screen coordinates transformation.
See also: