ConvertPtToView(Pt: IGxPoint): IGxPointF;
Pt. Point in pixels.
The ConvertPtToView method converts the defined point in pixels into a point in millimeters.
Executing the example requires a form with the WorkspaceBox component named WorkspaceBox1 and a data source for WorkspaceBox1.
Add links to the Andy, Drawing, Workspace system assemblies.
Sub WorkspaceBox1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
WS: IWxWorkspace;
View: IWxView;
Point: IGxPointF;
Ellipse: IWxEllipse;
Begin
WS := UiWorkspace1.WxWorkspace;
View := WS.Views.Item(0);
View.Id := "MyView";
View.Scale := 0.5;
View.Size := New GxSizeF.Create(100.55,100.66);
Point := View.ConvertPtToView(New GxPoint.Create(Args.pPoint.X, Args.pPoint.Y));
Ellipse := WS.CreateEllipse;
Ellipse.PinPosition := View.ViewToWorkspace(Point);
//Coordiantes
Debug.WriteLine(Args.pPoint.X.ToString + " " + Args.pPoint.Y.ToString);
Debug.WriteLine(Point.X.ToString + " " + Point.Y.ToString);
Debug.WriteLine(Ellipse.PinPosition.X.ToString + " " + Ellipse.PinPosition.Y.ToString);
End Sub WorkspaceBox1OnClick;
After executing the example the workspace view will be created and parameters will be set, clicking the button will also display an ellipse.
See also: