public User32Point ScreenToClient(User32Point rect) { User32Point clientPoint = rect; ScreenToClientInPlace(ref clientPoint); return(clientPoint); }
public User32Point ClientToScreen(User32Point point) { User32Point screenPoint = point; ClientToScreenInPlace(ref screenPoint); return(screenPoint); }
public bool ScreenToClientInPlace(ref User32Point point) { unsafe { fixed(User32Point *lpPoint = &point) { return(User32APIs.ScreenToClient(Hwnd, lpPoint)); } } }
public bool ClientToScreenInPlace(ref User32Point point) { unsafe { fixed(User32Point *lpPoint = &point) { return(User32APIs.ClientToScreen(Hwnd, lpPoint)); } } }
public static Point?GetCaretPosition(IServiceProvider serviceProvider) { try { var vsTextManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager)); ErrorHandler.ThrowOnFailure(vsTextManager.GetActiveView(Convert.ToInt32(true), null, out var activeView)); if (activeView == null) { return(null); } ErrorHandler.ThrowOnFailure(activeView.GetCaretPos(out var caretLine, out var caretColumn)); var interopPoint = new POINT[1]; ErrorHandler.ThrowOnFailure(activeView.GetPointOfLineColumn(caretLine + 1, caretColumn + 1, interopPoint)); var p = new User32Point(interopPoint[0].x, interopPoint[0].y); ErrorHandler.ThrowOnFailure(ClientToScreen(activeView.GetWindowHandle(), p)); var wpfTextView = GetWpfTextView(serviceProvider, activeView) as Visual; if (wpfTextView != null) { var target = PresentationSource.FromVisual(wpfTextView)?.CompositionTarget; if (target != null) { var transformedPoint = target.TransformFromDevice.Transform(new Point(p.x, p.y)); return(transformedPoint); } } return(new Point(p.x, p.y)); } catch (Exception ex) { Debug.WriteLine(ex); return(null); } }
public static extern int ClientToScreen(IntPtr hWnd, [In, Out] User32Point pt);
public static WindowControl WindowFromPoint(User32Point point) { IntPtr hwnd = User32APIs.WindowFromPoint(point); return(new WindowControl(hwnd)); }
public WindowControl ChildWindowFromPointEx(User32Point point, uint uFlags) { return(new WindowControl(User32APIs.ChildWindowFromPointEx(Hwnd, point, uFlags))); }
public WindowControl ChildWindowFromPoint(User32Point point) { return(new WindowControl(User32APIs.ChildWindowFromPoint(Hwnd, point))); }