0

I have the mouse pointer location from

Point loc = PointToScreen(Mouse.GetPosition(this));
new SecondWindow() { Owner = this, Left = loc.X, Top = loc.Y }.ShowDialog();

to get X and Y coordinates. I have to open the new window at the exact position of the mouse, but there is a very very noticeable offset for both Left and Top Properties of the window startup location.

Any idea or/and solution why is it happening??

AniAxe
  • 5
  • 3
  • I guess you don't properly manage DPI stuff. It's quite onerous but you can find tons of tips in SO. – emoacht Mar 29 '23 at 11:18
  • 1
    Can you provide some code ? *same location* is vague, is it the top left corner or the center of the new window ? the same location as what ? The cursor ? – Orace Mar 29 '23 at 11:36
  • If the monitor's DPI is 100% and it is primary one, OP's code will mostly work. But it is not always the case. – emoacht Mar 29 '23 at 14:28

0 Answers0