void UngrabCursor() { if (!Functions.ClipCursor(IntPtr.Zero)) { Debug.WriteLine(String.Format("Failed to ungrab cursor. Error: {0}", Marshal.GetLastWin32Error())); } }
private void GrabCursor() { Point point = this.PointToScreen(new Point(this.ClientRectangle.X, this.ClientRectangle.Y)); Functions.ClipCursor(ref new Win32Rectangle() { left = point.X, right = point.X + this.ClientRectangle.Width, top = point.Y, bottom = point.Y + this.ClientRectangle.Height }); }
void GrabCursor() { Win32Rectangle rect = Win32Rectangle.From(ClientRectangle); Point pos = PointToScreen(new Point(rect.left, rect.top)); rect.left = pos.X; rect.top = pos.Y; if (!Functions.ClipCursor(ref rect)) { Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}", Marshal.GetLastWin32Error())); } }
void GrabCursor() { Point pos = PointToScreen(new Point(ClientRectangle.X, ClientRectangle.Y)); Win32Rectangle rect = new Win32Rectangle(); rect.left = pos.X; rect.right = pos.X + ClientRectangle.Width; rect.top = pos.Y; rect.bottom = pos.Y + ClientRectangle.Height; if (!Functions.ClipCursor(ref rect)) { Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}", Marshal.GetLastWin32Error())); } }
private void UngrabCursor() { Functions.ClipCursor(IntPtr.Zero); }