public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle backgroundRectangle, IntPtr hRgn, Point pt, HitTestOptions options) {
            if( dc == null ){
                throw new ArgumentNullException("dc");
            }
            
            int htCode = 0;
            NativeMethods.POINTSTRUCT point = new NativeMethods.POINTSTRUCT(pt.X, pt.Y);

            using( WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper( dc, AllGraphicsProperties ) ) {
                HandleRef hdc = new HandleRef( wgr, wgr.WindowsGraphics.DeviceContext.Hdc );
                lastHResult = SafeNativeMethods.HitTestThemeBackground( new HandleRef( this, Handle ), hdc, part, state, (int) options, new NativeMethods.COMRECT( backgroundRectangle ), new HandleRef( this, hRgn ), point, ref htCode );
            }

            return (HitTestCode)htCode;
        }
Пример #2
0
 /// <include file='doc\Screen.uex' path='docs/doc[@for="Screen.FromPoint"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Retrieves a <see cref='System.Windows.Forms.Screen'/>
 ///       for the monitor that contains the specified point.
 ///       
 ///    </para>
 /// </devdoc>
 public static Screen FromPoint(Point point) {
     if (multiMonitorSupport) {
         NativeMethods.POINTSTRUCT pt = new NativeMethods.POINTSTRUCT(point.X, point.Y);
         return new Screen(SafeNativeMethods.MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST));
     }
     else {
         return new Screen((IntPtr)PRIMARY_MONITOR);
     }
 }