private NativeMethods.ComboBoxInfo GetComboBoxInfo() { NativeMethods.ComboBoxInfo cbi = new NativeMethods.ComboBoxInfo(); cbi.cbSize = Marshal.SizeOf(cbi); NativeMethods.GetComboBoxInfo(base.Handle, ref cbi); return(cbi); }
protected override void OnCreateControl() { base.OnCreateControl(); NativeMethods.ComboBoxInfo cbi = GetComboBoxInfo(); _editHandle = cbi.hwndEdit; }
protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); NativeMethods.ComboBoxInfo cbi = new NativeMethods.ComboBoxInfo(); cbi.cbSize = Marshal.SizeOf(cbi); NativeMethods.GetComboBoxInfo(base.Handle, ref cbi); _editHandle = cbi.hwndEdit; if (DropDownStyle != ComboBoxStyle.DropDownList) { _editNativeWindow = new EditNativeWindow(this); } }
protected override void OnCreateControl() { base.OnCreateControl(); //设置为手动绘制 this.DrawMode = DrawMode.OwnerDrawFixed; //设置固定的DropDownList样式 this.DropDownStyle = ComboBoxStyle.DropDownList; this.ItemHeight = 25; //设置为手动绘制 if (!DesignMode && this.Items.Count != 0) { this.DropDownHeight = this.Items.Count * 5; if (this.DropDownHeight > 150) { this.DropDownHeight = 150; } } NativeMethods.ComboBoxInfo cbi = GetComboBoxInfo(); _editHandle = cbi.hwndEdit; dplisthandel = cbi.hwndList; }
private Rectangle GetDropDownButtonRect() { NativeMethods.ComboBoxInfo cbi = GetComboBoxInfo(); return(cbi.rcButton.Rect); }
private bool GetComboBoxButtonPressed() { NativeMethods.ComboBoxInfo cbi = GetComboBoxInfo(); return(cbi.stateButton == NativeMethods.ComboBoxButtonState.STATE_SYSTEM_PRESSED); }