Пример #1
0
 /// <summary>
 /// 限制鼠标在屏幕上的一个区域内
 /// </summary>
 /// <param name="rect">限制区域</param>
 public static void Look(Rectangle rect)
 {
     LPRECT lpRect = new LPRECT() { Left = rect.Left, Top = rect.Top, Right = rect.Right, Bottom = rect.Bottom };
     if (ClipCursor(ref lpRect) == false)
     {
         throw new Win32Exception(Marshal.GetLastWin32Error());
     }
 }
Пример #2
0
 /// <summary>
 /// 获取限制鼠标的区域(若无限制则返回屏幕区域)
 /// </summary>
 /// <returns>限制鼠标的区域</returns>
 public static Rectangle GetLockRect()
 {
     LPRECT lpRect = new LPRECT();
     if (GetClipCursor(ref lpRect) == false)
     {
         throw new Win32Exception(Marshal.GetLastWin32Error());
     }
     return new Rectangle(lpRect.Left, lpRect.Top, lpRect.Right - lpRect.Left, lpRect.Bottom - lpRect.Top);
 }
Пример #3
0
 private static extern bool GetClientRect(IntPtr hwnd, out LPRECT lpRect);
Пример #4
0
 private static extern bool GetWindowRect(IntPtr hWnd, out LPRECT lpRect);
Пример #5
0
 private static extern bool GetWindowRect(IntPtr hWnd, ref LPRECT rect);
 internal static extern int GetWindowRect(System.IntPtr hWnd, ref LPRECT lpRect);
Пример #7
0
 public static extern bool RedrawWindow(IntPtr hwnd, ref LPRECT rcUpdate, IntPtr hrgnUpdate, int flags);
Пример #8
0
 public static extern bool InvalidateRect(IntPtr hWnd, ref LPRECT lpRect, bool bErase);
Пример #9
0
 [DllImport("user32.dll")]//获得句柄对象的位置
 public static extern bool GetWindowRect(IntPtr hWnd, out LPRECT lpRect);
Пример #10
0
 private static extern bool GetClipCursor(ref LPRECT lpRect);