예제 #1
0
        /// <summary>
        ///  Creates a new clipping region from the intersection of the current clipping region and
        ///  the specified rectangle.
        /// </summary>
        public void IntersectClip(WindowsRegion wr)
        {
            //if the incoming windowsregion is infinite, there is no need to do any intersecting.
            if (wr.HRegion == IntPtr.Zero)
            {
                return;
            }

            WindowsRegion clip = new WindowsRegion(0, 0, 0, 0);

            try
            {
                int result = Gdi32.GetClipRgn(new HandleRef(this, Hdc), new HandleRef(clip, clip.HRegion));

                // If the function succeeds and there is a clipping region for the given device context, the return value is 1.
                if (result == 1)
                {
                    Debug.Assert(clip.HRegion != IntPtr.Zero);
                    wr.CombineRegion(clip, wr, Gdi32.CombineMode.RGN_AND);
                }

                SetClip(wr);
            }
            finally
            {
                clip.Dispose();
            }
        }
예제 #2
0
        /// <summary>
        ///  Selects a region as the current clipping region for the device context.
        ///  Remarks (From MSDN):
        ///  - Only a copy of the selected region is used. The region itself can be selected for any number of other device contexts or it can be deleted.
        ///  - The SelectClipRgn function assumes that the coordinates for a region are specified in device units.
        ///  - To remove a device-context's clipping region, specify a NULL region handle.
        /// </summary>
        public void SetClip(WindowsRegion region)
        {
            HandleRef hdc     = new HandleRef(this, Hdc);
            HandleRef hRegion = new HandleRef(region, region.HRegion);

            IntUnsafeNativeMethods.SelectClipRgn(hdc, hRegion);
        }
예제 #3
0
        /// <summary>
        ///  Selects a region as the current clipping region for the device context.
        ///  Remarks (From MSDN):
        ///  - Only a copy of the selected region is used. The region itself can be selected for any number of other device contexts or it can be deleted.
        ///  - The SelectClipRgn function assumes that the coordinates for a region are specified in device units.
        ///  - To remove a device-context's clipping region, specify a NULL region handle.
        /// </summary>
        public void SetClip(WindowsRegion region)
        {
            HandleRef hdc     = new HandleRef(this, Hdc);
            HandleRef hRegion = new HandleRef(region, region.HRegion);

            Gdi32.SelectClipRgn(hdc, hRegion);
        }
 public static WindowsRegion FromHregion(IntPtr hRegion, bool takeOwnership)
 {
     WindowsRegion region = new WindowsRegion();
     if (hRegion != IntPtr.Zero)
     {
         region.nativeHandle = hRegion;
         if (takeOwnership)
         {
             region.ownHandle = true;
             System.Internal.HandleCollector.Add(hRegion, IntSafeNativeMethods.CommonHandles.GDI);
         }
     }
     return region;
 }
예제 #5
0
 public void IntersectClip(WindowsRegion wr)
 {
     if (wr.HRegion != IntPtr.Zero)
     {
         using (WindowsRegion region = new WindowsRegion(0, 0, 0, 0))
         {
             if (IntUnsafeNativeMethods.GetClipRgn(new HandleRef(this, this.Hdc), new HandleRef(region, region.HRegion)) == 1)
             {
                 wr.CombineRegion(region, wr, RegionCombineMode.AND);
             }
             this.SetClip(wr);
         }
     }
 }
        public static WindowsGraphics FromGraphics(Graphics g, ApplyGraphicsProperties properties)
        {
            WindowsRegion wr = null;

            float[] elements = null;
            Region  region   = null;
            Matrix  matrix   = null;

            if (((properties & ApplyGraphicsProperties.TranslateTransform) != ApplyGraphicsProperties.None) || ((properties & ApplyGraphicsProperties.Clipping) != ApplyGraphicsProperties.None))
            {
                object[] contextInfo = g.GetContextInfo() as object[];
                if ((contextInfo != null) && (contextInfo.Length == 2))
                {
                    region = contextInfo[0] as Region;
                    matrix = contextInfo[1] as Matrix;
                }
                if (matrix != null)
                {
                    if ((properties & ApplyGraphicsProperties.TranslateTransform) != ApplyGraphicsProperties.None)
                    {
                        elements = matrix.Elements;
                    }
                    matrix.Dispose();
                }
                if (region != null)
                {
                    if (((properties & ApplyGraphicsProperties.Clipping) != ApplyGraphicsProperties.None) && !region.IsInfinite(g))
                    {
                        wr = WindowsRegion.FromRegion(region, g);
                    }
                    region.Dispose();
                }
            }
            WindowsGraphics graphics = FromHdc(g.GetHdc());

            graphics.graphics = g;
            if (wr != null)
            {
                using (wr)
                {
                    graphics.DeviceContext.IntersectClip(wr);
                }
            }
            if (elements != null)
            {
                graphics.DeviceContext.TranslateTransform((int)elements[4], (int)elements[5]);
            }
            return(graphics);
        }
        public static WindowsRegion FromHregion(IntPtr hRegion, bool takeOwnership)
        {
            WindowsRegion region = new WindowsRegion();

            if (hRegion != IntPtr.Zero)
            {
                region.nativeHandle = hRegion;
                if (takeOwnership)
                {
                    region.ownHandle = true;
                    System.Internal.HandleCollector.Add(hRegion, IntSafeNativeMethods.CommonHandles.GDI);
                }
            }
            return(region);
        }
예제 #8
0
        // Consider implementing a constructor that calls ExtCreateRegion(XFORM lpXform, DWORD nCount, RGNDATA lpRgnData) if needed.

        /// <summary>
        ///  Creates a WindowsRegion from a region handle, if 'takeOwnership' is true, the handle is added to the HandleCollector
        ///  and is removed & destroyed on dispose.
        /// </summary>
        public static WindowsRegion FromHregion(IntPtr hRegion, bool takeOwnership)
        {
            WindowsRegion wr = new WindowsRegion();

            // Note: Passing IntPtr.Zero for hRegion is ok.  GDI+ infinite regions will have hRegion == null.
            // GDI's SelectClipRgn interprets null region handle as resetting the clip region (all region will be available for painting).
            if (hRegion != IntPtr.Zero)
            {
                wr.nativeHandle = hRegion;

                if (takeOwnership)
                {
                    wr.ownHandle = true;
                }
            }
            return(wr);
        }
예제 #9
0
        /// <summary>
        ///  Creates a WindowsRegion from a System.Drawing.Region.
        /// </summary>
        public static WindowsRegion FromRegion(Region region, Graphics g)
        {
            if (region.IsInfinite(g))
            {
                // An infinite region would cover the entire device region which is the same as
                // not having a clipping region. Observe that this is not the same as having an
                // empty region, which when clipping to it has the effect of excluding the entire
                // device region.
                // To remove the clip region from a dc the SelectClipRgn() function needs to be
                // called with a null region ptr - that's why we use the empty constructor here.
                // GDI+ will return IntPtr.Zero for Region.GetHrgn(Graphics) when the region is
                // Infinite.
                return(new WindowsRegion());
            }

            return(WindowsRegion.FromHregion(region.GetHrgn(g), true));
        }
예제 #10
0
        public static WindowsGraphics FromGraphics(Graphics g, ApplyGraphicsProperties properties)
        {
            WindowsRegion wr = null;

            float[] elements = null;

            Region clipRgn     = null;
            Matrix worldTransf = null;

            if ((properties & ApplyGraphicsProperties.TranslateTransform) != 0 || (properties & ApplyGraphicsProperties.Clipping) != 0)
            {
                if (g.GetContextInfo() is object[] data && data.Length == 2)
                {
                    clipRgn     = data[0] as Region;
                    worldTransf = data[1] as Matrix;
                }

                if (worldTransf != null)
                {
                    if ((properties & ApplyGraphicsProperties.TranslateTransform) != 0)
                    {
                        elements = worldTransf.Elements;
                    }
                    worldTransf.Dispose();
                }

                if (clipRgn != null)
                {
                    if ((properties & ApplyGraphicsProperties.Clipping) != 0)
                    {
                        // We have to create the WindowsRegion and dipose the Region object before locking the Graphics object,
                        // in case of an unlikely exception before releasing the WindowsRegion, the finalizer will do it for us.
                        // (no try-finally block since this method is used frequently - perf).
                        // If the Graphics.Clip has not been set (Region.IsInfinite) we don't need to apply it to the DC.
                        if (!clipRgn.IsInfinite(g))
                        {
                            wr = WindowsRegion.FromRegion(clipRgn, g); // WindowsRegion will take ownership of the hRegion.
                        }
                    }
                    clipRgn.Dispose(); // Disposing the Region object doesn't destroy the hRegion.
                }
            }

            WindowsGraphics wg = FromHdc(g.GetHdc()); // This locks the Graphics object.

            wg._graphics = g;

            // Apply transform and clip
            if (wr != null)
            {
                using (wr)
                {
                    // If the Graphics object was created from a native DC the actual clipping region is the intersection
                    // beteween the original DC clip region and the GDI+ one - for display Graphics it is the same as
                    // Graphics.VisibleClipBounds.
                    wg.DeviceContext.IntersectClip(wr);
                }
            }

            if (elements != null)
            {
                // elements (XFORM) = [eM11, eM12, eM21, eM22, eDx, eDy], eDx/eDy specify the translation offset.
                wg.DeviceContext.TranslateTransform((int)elements[4], (int)elements[5]);
            }

            return(wg);
        }
예제 #11
0
파일: ComboBox.cs 프로젝트: mind0n/hive
        protected override void WndProc(ref Message m) {
            switch (m.Msg) {
                // We don't want to fire the focus events twice -
                // once in the combobox and once in the ChildWndProc.
                case NativeMethods.WM_SETFOCUS:
                    try {
                        fireSetFocus = false;
                        base.WndProc(ref m);
                    }
                        
                    finally {
                        fireSetFocus = true;
                    }
                    break;
                case NativeMethods.WM_KILLFOCUS:
                    try {
                        fireLostFocus = false;
                        base.WndProc(ref m);
                        // Nothing to see here... Just keep on walking... VSWhidbey 504477.
                        // Turns out that with Theming off, we don't get quite the same messages as with theming on.
                        
                        // With theming on we get a WM_MOUSELEAVE after a WM_KILLFOCUS even if you use the Tab key
                        // to move focus. Our response to WM_MOUSELEAVE causes us to repaint everything correctly.

                        // With theming off, we do not get a WM_MOUSELEAVE after a WM_KILLFOCUS, and since we don't have a childwndproc
                        // when we are a Flat DropDownList, we need to force a repaint. The easiest way to do this is to send a 
                        // WM_MOUSELEAVE to ourselves, since that also sets up the right state. Or... at least the state is the same
                        // as with Theming on.

                        // This is such a @#$(*&#@$ hack.
                        
                        if (!Application.RenderWithVisualStyles && GetStyle(ControlStyles.UserPaint) == false && this.DropDownStyle == ComboBoxStyle.DropDownList && (FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup)) {
                            UnsafeNativeMethods.PostMessage(new HandleRef(this, Handle), NativeMethods.WM_MOUSELEAVE, 0, 0);                            
                        }
                    }

                    finally {
                        fireLostFocus = true;
                    }
                    break;
                case NativeMethods.WM_CTLCOLOREDIT:
                case NativeMethods.WM_CTLCOLORLISTBOX:
                    m.Result = InitializeDCForWmCtlColor(m.WParam, m.Msg);
                    break;
                case NativeMethods.WM_ERASEBKGND:
                    WmEraseBkgnd(ref m);
                    break;
                case NativeMethods.WM_PARENTNOTIFY:
                    WmParentNotify(ref m);
                    break;
                case NativeMethods.WM_REFLECT + NativeMethods.WM_COMMAND:
                    WmReflectCommand(ref m);
                    break;
                case NativeMethods.WM_REFLECT + NativeMethods.WM_DRAWITEM:
                    WmReflectDrawItem(ref m);
                    break;
                case NativeMethods.WM_REFLECT + NativeMethods.WM_MEASUREITEM:
                    WmReflectMeasureItem(ref m);
                    break;
                case NativeMethods.WM_LBUTTONDOWN:
                    mouseEvents = true;
                    base.WndProc(ref m);
                    break;
                case NativeMethods.WM_LBUTTONUP:
                    // Get the mouse location
                    //
                    NativeMethods.RECT r = new NativeMethods.RECT();
                    UnsafeNativeMethods.GetWindowRect(new HandleRef(this, Handle), ref r);
                    Rectangle ClientRect = new Rectangle(r.left, r.top, r.right - r.left, r.bottom - r.top);

                    int x = NativeMethods.Util.SignedLOWORD(m.LParam);
                    int y = NativeMethods.Util.SignedHIWORD(m.LParam);
                    Point pt = new Point(x, y);
                    pt = PointToScreen(pt);
                    //mouseEvents is used to keep the check that we get the WM_LBUTTONUP after
                    //WM_LBUTTONDOWN or WM_LBUTTONDBLBCLK
                    // combo box gets a WM_LBUTTONUP for focus change ...
                    //
                    if (mouseEvents && !ValidationCancelled) {
                        mouseEvents = false;
                        bool captured = Capture;
                        if (captured && ClientRect.Contains(pt)) {
                            OnClick(new MouseEventArgs(MouseButtons.Left, 1, NativeMethods.Util.SignedLOWORD(m.LParam), NativeMethods.Util.SignedHIWORD(m.LParam), 0));
                            OnMouseClick(new MouseEventArgs(MouseButtons.Left, 1, NativeMethods.Util.SignedLOWORD(m.LParam), NativeMethods.Util.SignedHIWORD(m.LParam), 0));

                        }
                        base.WndProc(ref m);
                    }
                    else {
                        CaptureInternal = false;
                        DefWndProc(ref m);
                    }
                    break;

                case NativeMethods.WM_MOUSELEAVE:
                    DefWndProc(ref m);
                    OnMouseLeaveInternal(EventArgs.Empty);
                    break;

                case NativeMethods.WM_PAINT:
                    if (GetStyle(ControlStyles.UserPaint) == false && (FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup)) {

                        using (WindowsRegion dr = new WindowsRegion(FlatComboBoxAdapter.dropDownRect)) {
                            using (WindowsRegion wr = new WindowsRegion(this.Bounds)) {

                                // Stash off the region we have to update (the base is going to clear this off in BeginPaint)
                                NativeMethods.RegionFlags updateRegionFlags = (NativeMethods.RegionFlags)SafeNativeMethods.GetUpdateRgn(new HandleRef(this, this.Handle), new HandleRef(this, wr.HRegion), true);

                                dr.CombineRegion(wr, dr, RegionCombineMode.DIFF);

                                Rectangle updateRegionBoundingRect = wr.ToRectangle();
                                FlatComboBoxAdapter.ValidateOwnerDrawRegions(this, updateRegionBoundingRect);
                                // Call the base class to do its painting (with a clipped DC).

                                NativeMethods.PAINTSTRUCT ps = new NativeMethods.PAINTSTRUCT();
                                IntPtr dc;
                                bool disposeDc = false;
                                if (m.WParam == IntPtr.Zero) {
                                    dc = UnsafeNativeMethods.BeginPaint(new HandleRef(this, Handle), ref ps);
                                    disposeDc = true;
                                }
                                else {
                                    dc = m.WParam;
                                }

                                using (DeviceContext mDC = DeviceContext.FromHdc(dc)) {
                                    using (WindowsGraphics wg = new WindowsGraphics(mDC)) {
                                        if (updateRegionFlags != NativeMethods.RegionFlags.ERROR) {
                                            wg.DeviceContext.SetClip(dr);
                                        }
                                        m.WParam = dc;
                                        DefWndProc(ref m);
                                        if (updateRegionFlags != NativeMethods.RegionFlags.ERROR) {
                                            wg.DeviceContext.SetClip(wr);
                                        }
                                        using (Graphics g = Graphics.FromHdcInternal(dc)) {
                                            FlatComboBoxAdapter.DrawFlatCombo(this, g);
                                        }
                                    }
                                }

                                if (disposeDc) {
                                    UnsafeNativeMethods.EndPaint(new HandleRef(this, Handle), ref ps);
                                }

                            }
                            return;
                        }
                    }
                    
                    base.WndProc(ref m);
                    break;
                case NativeMethods.WM_PRINTCLIENT: 
                    // all the fancy stuff we do in OnPaint has to happen again in OnPrint.
                    if (GetStyle(ControlStyles.UserPaint) == false && FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup) {
                        DefWndProc(ref m);
                        
                        if ((unchecked( (int) (long)m.LParam) & NativeMethods.PRF_CLIENT) == NativeMethods.PRF_CLIENT) { 
                            if (GetStyle(ControlStyles.UserPaint) == false && FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup) {
                                using (Graphics g = Graphics.FromHdcInternal(m.WParam)) {
                                    FlatComboBoxAdapter.DrawFlatCombo(this,g);
                                }
                            }
                            return;
                        }
                    }
                    base.WndProc(ref m);
                    return;                    
                case NativeMethods.WM_SETCURSOR:
                    base.WndProc(ref m);
                    break;

                case NativeMethods.WM_SETFONT:
                    //(bug 119265)
                    if (Width == 0) {
                        suppressNextWindosPos = true;
                    }
                    base.WndProc(ref m);
                    break;


                case NativeMethods.WM_WINDOWPOSCHANGED:
                    if (!suppressNextWindosPos) {
                        base.WndProc(ref m);
                    }
                    suppressNextWindosPos = false;
                    break;

                case NativeMethods.WM_NCDESTROY:
                    base.WndProc(ref m);
                    ReleaseChildWindow();
                    break;
                    
                default:
                    if (m.Msg == NativeMethods.WM_MOUSEENTER) {
                        DefWndProc(ref m);
                        OnMouseEnterInternal(EventArgs.Empty);
                        break;
                    }
                    base.WndProc(ref m);
                    break;
            }
        }
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case 7:
                    try
                    {
                        this.fireSetFocus = false;
                        base.WndProc(ref m);
                        return;
                    }
                    finally
                    {
                        this.fireSetFocus = true;
                    }
                    break;

                case 8:
                    break;

                case 15:
                    if (!base.GetStyle(ControlStyles.UserPaint) && ((this.FlatStyle == System.Windows.Forms.FlatStyle.Flat) || (this.FlatStyle == System.Windows.Forms.FlatStyle.Popup)))
                    {
                        using (WindowsRegion region = new WindowsRegion(this.FlatComboBoxAdapter.dropDownRect))
                        {
                            using (WindowsRegion region2 = new WindowsRegion(base.Bounds))
                            {
                                IntPtr wParam;
                                System.Windows.Forms.NativeMethods.RegionFlags flags = (System.Windows.Forms.NativeMethods.RegionFlags) System.Windows.Forms.SafeNativeMethods.GetUpdateRgn(new HandleRef(this, base.Handle), new HandleRef(this, region2.HRegion), true);
                                region.CombineRegion(region2, region, RegionCombineMode.DIFF);
                                Rectangle updateRegionBox = region2.ToRectangle();
                                this.FlatComboBoxAdapter.ValidateOwnerDrawRegions(this, updateRegionBox);
                                System.Windows.Forms.NativeMethods.PAINTSTRUCT lpPaint = new System.Windows.Forms.NativeMethods.PAINTSTRUCT();
                                bool flag2 = false;
                                if (m.WParam == IntPtr.Zero)
                                {
                                    wParam = System.Windows.Forms.UnsafeNativeMethods.BeginPaint(new HandleRef(this, base.Handle), ref lpPaint);
                                    flag2 = true;
                                }
                                else
                                {
                                    wParam = m.WParam;
                                }
                                using (DeviceContext context = DeviceContext.FromHdc(wParam))
                                {
                                    using (WindowsGraphics graphics = new WindowsGraphics(context))
                                    {
                                        if (flags != System.Windows.Forms.NativeMethods.RegionFlags.ERROR)
                                        {
                                            graphics.DeviceContext.SetClip(region);
                                        }
                                        m.WParam = wParam;
                                        this.DefWndProc(ref m);
                                        if (flags != System.Windows.Forms.NativeMethods.RegionFlags.ERROR)
                                        {
                                            graphics.DeviceContext.SetClip(region2);
                                        }
                                        using (Graphics graphics2 = Graphics.FromHdcInternal(wParam))
                                        {
                                            this.FlatComboBoxAdapter.DrawFlatCombo(this, graphics2);
                                        }
                                    }
                                }
                                if (flag2)
                                {
                                    System.Windows.Forms.UnsafeNativeMethods.EndPaint(new HandleRef(this, base.Handle), ref lpPaint);
                                }
                            }
                            return;
                        }
                    }
                    base.WndProc(ref m);
                    return;

                case 20:
                    this.WmEraseBkgnd(ref m);
                    return;

                case 0x47:
                    if (!this.suppressNextWindosPos)
                    {
                        base.WndProc(ref m);
                    }
                    this.suppressNextWindosPos = false;
                    return;

                case 130:
                    base.WndProc(ref m);
                    this.ReleaseChildWindow();
                    return;

                case 0x20:
                    base.WndProc(ref m);
                    return;

                case 0x30:
                    if (base.Width == 0)
                    {
                        this.suppressNextWindosPos = true;
                    }
                    base.WndProc(ref m);
                    return;

                case 0x133:
                case 0x134:
                    goto Label_017F;

                case 0x201:
                    this.mouseEvents = true;
                    base.WndProc(ref m);
                    return;

                case 0x202:
                {
                    System.Windows.Forms.NativeMethods.RECT rect = new System.Windows.Forms.NativeMethods.RECT();
                    System.Windows.Forms.UnsafeNativeMethods.GetWindowRect(new HandleRef(this, base.Handle), ref rect);
                    Rectangle rectangle = new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
                    int x = System.Windows.Forms.NativeMethods.Util.SignedLOWORD(m.LParam);
                    int y = System.Windows.Forms.NativeMethods.Util.SignedHIWORD(m.LParam);
                    Point p = new Point(x, y);
                    p = base.PointToScreen(p);
                    if (this.mouseEvents && !base.ValidationCancelled)
                    {
                        this.mouseEvents = false;
                        if (base.Capture && rectangle.Contains(p))
                        {
                            this.OnClick(new MouseEventArgs(MouseButtons.Left, 1, System.Windows.Forms.NativeMethods.Util.SignedLOWORD(m.LParam), System.Windows.Forms.NativeMethods.Util.SignedHIWORD(m.LParam), 0));
                            this.OnMouseClick(new MouseEventArgs(MouseButtons.Left, 1, System.Windows.Forms.NativeMethods.Util.SignedLOWORD(m.LParam), System.Windows.Forms.NativeMethods.Util.SignedHIWORD(m.LParam), 0));
                        }
                        base.WndProc(ref m);
                        return;
                    }
                    base.CaptureInternal = false;
                    this.DefWndProc(ref m);
                    return;
                }
                case 0x210:
                    this.WmParentNotify(ref m);
                    return;

                case 0x202b:
                    this.WmReflectDrawItem(ref m);
                    return;

                case 0x202c:
                    this.WmReflectMeasureItem(ref m);
                    return;

                case 0x2111:
                    this.WmReflectCommand(ref m);
                    return;

                case 0x2a3:
                    this.DefWndProc(ref m);
                    this.OnMouseLeaveInternal(EventArgs.Empty);
                    return;

                case 0x318:
                    if ((base.GetStyle(ControlStyles.UserPaint) || (this.FlatStyle != System.Windows.Forms.FlatStyle.Flat)) && (this.FlatStyle != System.Windows.Forms.FlatStyle.Popup))
                    {
                        goto Label_04EF;
                    }
                    this.DefWndProc(ref m);
                    if ((((int) ((long) m.LParam)) & 4) != 4)
                    {
                        goto Label_04EF;
                    }
                    if ((!base.GetStyle(ControlStyles.UserPaint) && (this.FlatStyle == System.Windows.Forms.FlatStyle.Flat)) || (this.FlatStyle == System.Windows.Forms.FlatStyle.Popup))
                    {
                        using (Graphics graphics3 = Graphics.FromHdcInternal(m.WParam))
                        {
                            this.FlatComboBoxAdapter.DrawFlatCombo(this, graphics3);
                        }
                    }
                    return;

                default:
                    if (m.Msg == System.Windows.Forms.NativeMethods.WM_MOUSEENTER)
                    {
                        this.DefWndProc(ref m);
                        this.OnMouseEnterInternal(EventArgs.Empty);
                        return;
                    }
                    base.WndProc(ref m);
                    return;
            }
            try
            {
                this.fireLostFocus = false;
                base.WndProc(ref m);
                if (((!Application.RenderWithVisualStyles && !base.GetStyle(ControlStyles.UserPaint)) && (this.DropDownStyle == ComboBoxStyle.DropDownList)) && ((this.FlatStyle == System.Windows.Forms.FlatStyle.Flat) || (this.FlatStyle == System.Windows.Forms.FlatStyle.Popup)))
                {
                    System.Windows.Forms.UnsafeNativeMethods.PostMessage(new HandleRef(this, base.Handle), 0x2a3, 0, 0);
                }
                return;
            }
            finally
            {
                this.fireLostFocus = true;
            }
        Label_017F:
            m.Result = this.InitializeDCForWmCtlColor(m.WParam, m.Msg);
            return;
        Label_04EF:
            base.WndProc(ref m);
        }
 public IntNativeMethods.RegionFlags CombineRegion(WindowsRegion region1, WindowsRegion region2, RegionCombineMode mode)
 {
     return(IntUnsafeNativeMethods.CombineRgn(new HandleRef(this, this.HRegion), new HandleRef(region1, region1.HRegion), new HandleRef(region2, region2.HRegion), mode));
 }
 public void SetClip(WindowsRegion region)
 {
     HandleRef hDC = new HandleRef(this, this.Hdc);
     HandleRef hRgn = new HandleRef(region, region.HRegion);
     IntUnsafeNativeMethods.SelectClipRgn(hDC, hRgn);
 }
 public void IntersectClip(WindowsRegion wr)
 {
     if (wr.HRegion != IntPtr.Zero)
     {
         using (WindowsRegion region = new WindowsRegion(0, 0, 0, 0))
         {
             if (IntUnsafeNativeMethods.GetClipRgn(new HandleRef(this, this.Hdc), new HandleRef(region, region.HRegion)) == 1)
             {
                 wr.CombineRegion(region, wr, RegionCombineMode.AND);
             }
             this.SetClip(wr);
         }
     }
 }
예제 #16
0
 /// <summary>
 ///  Combines region1 & region2 into this region.   The regions cannot be null.
 ///  The three regions need not be distinct. For example, the sourceRgn1 can equal this region.
 /// </summary>
 public Interop.RegionType CombineRegion(WindowsRegion region1, WindowsRegion region2, Interop.Gdi32.CombineMode mode)
 {
     return(Interop.Gdi32.CombineRgn(new HandleRef(this, HRegion), new HandleRef(region1, region1.HRegion), new HandleRef(region2, region2.HRegion), mode));
 }
 public IntNativeMethods.RegionFlags CombineRegion(WindowsRegion region1, WindowsRegion region2, RegionCombineMode mode)
 {
     return IntUnsafeNativeMethods.CombineRgn(new HandleRef(this, this.HRegion), new HandleRef(region1, region1.HRegion), new HandleRef(region2, region2.HRegion), mode);
 }