public static Size GetNonClientArea(IntPtr hwnd) { var c = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0); UnsafeNativeMethods.ClientToScreen(hwnd, ref c); var r = new RECT(); UnsafeNativeMethods.GetWindowRect(hwnd, ref r); return(new Size(c.X - r.left, c.Y - r.top)); }
/// <summary> /// Sets the specified peek (live preview) bitmap for the specified /// window. This is typically done in response to a DWM message. /// </summary> /// <param name="hwnd">The window handle.</param> /// <param name="bitmap">The thumbnail bitmap.</param> /// <param name="offset">The client area offset at which to display /// the specified bitmap. The rest of the parent window will be /// displayed as "remembered" by the DWM.</param> /// <param name="displayFrame">Whether to display a standard window /// frame around the bitmap.</param> public static void SetPeekBitmap(IntPtr hwnd, Bitmap bitmap, Point offset, bool displayFrame) { var nativePoint = new VistaBridgeInterop.SafeNativeMethods.POINT(offset.X, offset.Y); int rc = UnsafeNativeMethods.DwmSetIconicLivePreviewBitmap( hwnd, bitmap.GetHbitmap(), ref nativePoint, displayFrame ? SafeNativeMethods.DWM_SIT_DISPLAYFRAME : (uint)0); if (rc != 0) { throw Marshal.GetExceptionForHR(rc); } }
public static Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent) { var childScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0); UnsafeNativeMethods.ClientToScreen( hwnd, ref childScreenCoord); var parentScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0); UnsafeNativeMethods.ClientToScreen( hwndParent, ref parentScreenCoord); Point offset = new Point( childScreenCoord.X - parentScreenCoord.X, childScreenCoord.Y - parentScreenCoord.Y); return(offset); }
/// <summary> /// Sets the specified peek (live preview) bitmap for the specified /// window. This is typically done in response to a DWM message. /// </summary> /// <param name="hwnd">The window handle.</param> /// <param name="bitmap">The thumbnail bitmap.</param> /// <param name="offset">The client area offset at which to display /// the specified bitmap. The rest of the parent window will be /// displayed as "remembered" by the DWM.</param> /// <param name="displayFrame">Whether to display a standard window /// frame around the bitmap.</param> public static void SetPeekBitmap(IntPtr hwnd, Bitmap bitmap, Point offset, bool displayFrame) { var nativePoint = new VistaBridgeInterop.SafeNativeMethods.POINT(offset.X, offset.Y); int rc = UnsafeNativeMethods.DwmSetIconicLivePreviewBitmap( hwnd, bitmap.GetHbitmap(), ref nativePoint, displayFrame ? SafeNativeMethods.DWM_SIT_DISPLAYFRAME : (uint)0); if (rc != 0) throw Marshal.GetExceptionForHR(rc); }
public static Size GetNonClientArea(IntPtr hwnd) { var c = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0); UnsafeNativeMethods.ClientToScreen(hwnd, ref c); var r = new RECT(); UnsafeNativeMethods.GetWindowRect(hwnd, ref r); return new Size(c.X - r.left, c.Y - r.top); }
public static Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent) { var childScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0); UnsafeNativeMethods.ClientToScreen( hwnd, ref childScreenCoord); var parentScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0); UnsafeNativeMethods.ClientToScreen( hwndParent, ref parentScreenCoord); Point offset = new Point( childScreenCoord.X - parentScreenCoord.X, childScreenCoord.Y - parentScreenCoord.Y); return offset; }
public static extern bool ClientToScreen( IntPtr hwnd, ref VistaBridgeInterop.SafeNativeMethods.POINT point);
public static extern int DwmSetIconicLivePreviewBitmap( IntPtr hwnd, IntPtr hbitmap, ref VistaBridgeInterop.SafeNativeMethods.POINT ptClient, uint flags);