Reputation: 65
I need to find coordinates in a window.
Here not working formula:
Rectangle warwnd;
GetWindowRect(wprc.MainWindowHandle, out warwnd);
Int32 yy1 = warwnd.Height - (((warwnd.Height - warwnd.Top) / 100) * 94);
Int32 xx1 = warwnd.Width - (((warwnd.Width - warwnd.Left) / 100) * 97);
I need to find X,Y point in a window: 6 percent of window height and 3 percent of window width .
Upvotes: 1
Views: 81
Reputation: 57220
Absolute coordinates of the point:
Rectangle warwnd;
GetWindowRect(wprc.MainWindowHandle, out warwnd);
int yy1 = warwnd.Top + (int)(warwnd.Height * 0.06);
int xx1 = warwnd.Left + (int)(warwnd.Width * 0.03);
Relative coordinates (with respect to the top-left corner of the window)
Rectangle warwnd;
GetWindowRect(wprc.MainWindowHandle, out warwnd);
int yy1 = (int)(warwnd.Height * 0.06);
int xx1 = (int)(warwnd.Width * 0.03);
Upvotes: 3