How to get screen coordinate related to main form

How to get screen coordinate related to main form

silent_joe
Participant Participant
177 Views
0 Replies
Message 1 of 1

How to get screen coordinate related to main form

silent_joe
Participant
Participant

I want to get the red point position in screen related to the yellow point which is the main window position in screen. Then i can show a form  in that red position .Can anyone help me? 

silent_joe_0-1657783431095.png

int nCurVport = System.Convert.ToInt32(Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CVPORT"));
var acView = editor.GetCurrentView();
Point2d pCenter = acView.CenterPoint;
Point3d leftTop = new Point3d(pCenter.X - (acView.Width / 2), (acView.Height / 2) + pCenter.Y, 0);
System.Windows.Point screen_LeftTop = editor.PointToScreen(leftTop, nCurVport);
MessageBox.Show(screen_LeftTop.ToString());//this shows the red point is (0,0), but is not what i want

0 Likes
178 Views
0 Replies
Replies (0)