private void WmPaint(ref Message m) { if (base.DropDownStyle == ComboBoxStyle.Simple) { base.WndProc(ref m); return; } else//if (base.DropDownStyle == ComboBoxStyle.DropDown) { if (!_bPainting) { PAINTSTRUCT ps = new PAINTSTRUCT(); _bPainting = true; WinMethod.BeginPaint(m.HWnd, ref ps); RenderComboBox(ref m); WinMethod.EndPaint(m.HWnd, ref ps); _bPainting = false; m.Result = KnownParam.TRUE; } else { base.WndProc(ref m); } } //else //{ // base.WndProc(ref m); // RenderComboBox(ref m); //} }
private ComboBoxInfo GetComboBoxInfo() { ComboBoxInfo cbi = new ComboBoxInfo(); cbi.cbSize = Marshal.SizeOf(cbi); WinMethod.GetComboBoxInfo(base.Handle, ref cbi); return(cbi); }
/// <summary> /// 重绘文本款Border颜色 /// </summary> /// <param name="m"></param> protected override void WndProc(ref Message m) { base.WndProc(ref m); if (((m.Msg == WinMsgs.WM_NCPAINT) || (m.Msg == WinMsgs.WM_ERASEBKGND)) || (m.Msg == WinMsgs.WM_PAINT)) { IntPtr wParam = m.WParam; IntPtr hdc = WinMethod.GetDCEx(m.HWnd, wParam, 0x21); if (hdc != IntPtr.Zero) { Graphics graphics = Graphics.FromHdc(hdc); Rectangle bounds = new Rectangle(0, 0, base.Width, base.Height); ControlPaint.DrawBorder(graphics, bounds, this._borderColor, ButtonBorderStyle.Solid); m.Result = (IntPtr)1; WinMethod.ReleaseDC(m.HWnd, hdc); } } }