private void OnPaint(ref Message m) { System.Windows.Forms.NativeMethods.PAINTSTRUCT lpPaint = new System.Windows.Forms.NativeMethods.PAINTSTRUCT(); IntPtr hdc = System.Windows.Forms.UnsafeNativeMethods.BeginPaint(new HandleRef(this, base.Handle), ref lpPaint); this.CreateMirrorDC(hdc, this.windowBounds.Width - 1); try { for (int i = 0; i < this.items.Count; i++) { Rectangle iconBounds = ((ErrorProvider.ControlItem) this.items[i]).GetIconBounds(this.provider.Region.Size); System.Windows.Forms.SafeNativeMethods.DrawIconEx(new HandleRef(this, this.mirrordc.Hdc), iconBounds.X - this.windowBounds.X, iconBounds.Y - this.windowBounds.Y, new HandleRef(this.provider.Region, this.provider.Region.IconHandle), iconBounds.Width, iconBounds.Height, 0, System.Windows.Forms.NativeMethods.NullHandleRef, 3); } } finally { this.RestoreMirrorDC(); } System.Windows.Forms.UnsafeNativeMethods.EndPaint(new HandleRef(this, base.Handle), ref lpPaint); }
private void WndProc(ref Message msg) { int num2 = msg.Msg; if (num2 <= 0x21) { switch (num2) { case 3: this.WmMove(); return; case 15: goto Label_00FF; case 0x21: this.WmMouseActivate(ref msg); return; } goto Label_027D; } if (num2 <= 0x318) { switch (num2) { case 70: this.WmWindowPosChanging(ref msg); return; case 0x47: if (!this.WmWindowPosChanged()) { this.window.DefWndProc(ref msg); } return; case 0x318: goto Label_00FF; } goto Label_027D; } if (num2 == 0x410) { this.WmWindowFromPoint(ref msg); return; } if (num2 != 0x204e) { goto Label_027D; } System.Windows.Forms.NativeMethods.NMHDR lParam = (System.Windows.Forms.NativeMethods.NMHDR) msg.GetLParam(typeof(System.Windows.Forms.NativeMethods.NMHDR)); if ((lParam.code == -521) && !this.trackPosition) { this.WmShow(); return; } if (lParam.code == -522) { this.WmPop(); this.window.DefWndProc(ref msg); } return; Label_00FF: if ((this.ownerDraw && !this.isBalloon) && !this.trackPosition) { System.Windows.Forms.NativeMethods.PAINTSTRUCT lpPaint = new System.Windows.Forms.NativeMethods.PAINTSTRUCT(); Graphics graphics = Graphics.FromHdcInternal(System.Windows.Forms.UnsafeNativeMethods.BeginPaint(new HandleRef(this, this.Handle), ref lpPaint)); Rectangle bounds = new Rectangle(lpPaint.rcPaint_left, lpPaint.rcPaint_top, lpPaint.rcPaint_right - lpPaint.rcPaint_left, lpPaint.rcPaint_bottom - lpPaint.rcPaint_top); if (bounds == Rectangle.Empty) { return; } System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP toolinfo_tooltip = new System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP { cbSize = Marshal.SizeOf(typeof(System.Windows.Forms.NativeMethods.TOOLINFO_TOOLTIP)) }; if (((int) ((long) System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), System.Windows.Forms.NativeMethods.TTM_GETCURRENTTOOL, 0, toolinfo_tooltip))) != 0) { Font defaultFont; IWin32Window associatedWindow = (IWin32Window) this.owners[toolinfo_tooltip.hwnd]; Control associatedControl = Control.FromHandleInternal(toolinfo_tooltip.hwnd); if (associatedWindow == null) { associatedWindow = associatedControl; } System.Windows.Forms.IntSecurity.ObjectFromWin32Handle.Assert(); try { defaultFont = Font.FromHfont(System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), 0x31, 0, 0)); } catch (ArgumentException) { defaultFont = Control.DefaultFont; } finally { CodeAccessPermission.RevertAssert(); } try { this.OnDraw(new DrawToolTipEventArgs(graphics, associatedWindow, associatedControl, bounds, this.GetToolTip(associatedControl), this.BackColor, this.ForeColor, defaultFont)); return; } finally { graphics.Dispose(); System.Windows.Forms.UnsafeNativeMethods.EndPaint(new HandleRef(this, this.Handle), ref lpPaint); } } } Label_027D: this.window.DefWndProc(ref msg); }
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); }