Example #1
0
 public static Screen FromPoint(Point point)
 {
     if (multiMonitorSupport)
     {
         System.Windows.Forms.NativeMethods.POINTSTRUCT pt = new System.Windows.Forms.NativeMethods.POINTSTRUCT(point.X, point.Y);
         return(new Screen(System.Windows.Forms.SafeNativeMethods.MonitorFromPoint(pt, 2)));
     }
     return(new Screen((IntPtr)(-1163005939)));
 }
Example #2
0
        public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle backgroundRectangle, IntPtr hRgn, Point pt, HitTestOptions options)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }
            int pwHitTestCode = 0;

            System.Windows.Forms.NativeMethods.POINTSTRUCT ptTest = new System.Windows.Forms.NativeMethods.POINTSTRUCT(pt.X, pt.Y);
            using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping))
            {
                HandleRef hdc = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc);
                this.lastHResult = System.Windows.Forms.SafeNativeMethods.HitTestThemeBackground(new HandleRef(this, this.Handle), hdc, this.part, this.state, (int)options, new System.Windows.Forms.NativeMethods.COMRECT(backgroundRectangle), new HandleRef(this, hRgn), ptTest, ref pwHitTestCode);
            }
            return((HitTestCode)pwHitTestCode);
        }
 public static Screen FromPoint(Point point)
 {
     if (multiMonitorSupport)
     {
         System.Windows.Forms.NativeMethods.POINTSTRUCT pt = new System.Windows.Forms.NativeMethods.POINTSTRUCT(point.X, point.Y);
         return new Screen(System.Windows.Forms.SafeNativeMethods.MonitorFromPoint(pt, 2));
     }
     return new Screen((IntPtr) (-1163005939));
 }
 public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle backgroundRectangle, IntPtr hRgn, Point pt, HitTestOptions options)
 {
     if (dc == null)
     {
         throw new ArgumentNullException("dc");
     }
     int pwHitTestCode = 0;
     System.Windows.Forms.NativeMethods.POINTSTRUCT ptTest = new System.Windows.Forms.NativeMethods.POINTSTRUCT(pt.X, pt.Y);
     using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping))
     {
         HandleRef hdc = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc);
         this.lastHResult = System.Windows.Forms.SafeNativeMethods.HitTestThemeBackground(new HandleRef(this, this.Handle), hdc, this.part, this.state, (int) options, new System.Windows.Forms.NativeMethods.COMRECT(backgroundRectangle), new HandleRef(this, hRgn), ptTest, ref pwHitTestCode);
     }
     return (HitTestCode) pwHitTestCode;
 }
 public static extern IntPtr MonitorFromPoint(System.Windows.Forms.NativeMethods.POINTSTRUCT pt, int flags);
 public static extern int HitTestThemeBackground(HandleRef hTheme, HandleRef hdc, int iPartId, int iStateId, int dwOptions, [In] System.Windows.Forms.NativeMethods.COMRECT pRect, HandleRef hrgn, [In] System.Windows.Forms.NativeMethods.POINTSTRUCT ptTest, ref int pwHitTestCode);