private static void UpdateActiveScreen() { I2Point screenCenter; { DDWin32.POINT p; p.X = 0; p.Y = 0; DDWin32.ClientToScreen(DDWin32.GetMainWindowHandle(), out p); int l = p.X; int t = p.Y; int w = DDGround.RealScreen_W; int h = DDGround.RealScreen_H; screenCenter = new I2Point(l + w / 2, t + h / 2); } foreach (I4Rect monitor in DDWin32.GetAllMonitor()) { if ( monitor.L <= screenCenter.X && screenCenter.X < monitor.R && monitor.T <= screenCenter.Y && screenCenter.Y < monitor.B ) { DDGround.MonitorRect = monitor; break; } } }
private static void SetScreenPosition(int l, int t) { DX.SetWindowPosition(l, t); DDWin32.POINT p; p.X = 0; p.Y = 0; DDWin32.ClientToScreen(DDWin32.GetMainWindowHandle(), out p); int pToTrgX = l - (int)p.X; int pToTrgY = t - (int)p.Y; DX.SetWindowPosition(l + pToTrgX, t + pToTrgY); }