具有只读属性的ComboBox
為什么80%的碼農都做不了架構師?>>> ??
效果同TextBox的ReadOnly
??? public class ComboBoxTest : ComboBox ??? { ??????? private bool _ReadOnly;
??????? public ComboBoxTest() ??????????? : base() ??????? { ??????? }
??????? public bool ReadOnly ??????? { ??????????? get ??????????? { ??????????????? return this._ReadOnly; ??????????? } ??????????? set ??????????? { ??????????????? this._ReadOnly = value; ??????????????? this.TabStop = !value; ??????????????? if (value) ??????????????????? this.BackColor = System.Drawing.SystemColors.Control; ??????????????? else ??????????????????? this.BackColor = System.Drawing.SystemColors.Window; ??????????? } ??????? }
??????? protected override void WndProc(ref Message m) ??????? { ??????????? if (this._ReadOnly && (m.Msg == 0xa1 || m.Msg == 0x200 || m.Msg == 0x201 || ??????????????? m.Msg == 0x202 || m.Msg == 0x203 || m.Msg == 0x204 || m.Msg == 0x205 || ??????????????? m.Msg == 0x206 || m.Msg == 0x207 || m.Msg == 0x208 || m.Msg == 0x209)) ??????????? { ??????????????? return; ??????????? } ??????????? base.WndProc(ref m); ??????? }??????? ??? }
?
另外
WM_MOUSEMOVE = 0x200 WM_LBUTTONDOWN = 0x201 WM_RBUTTONDOWN = 0x204 WM_MBUTTONDOWN = 0x207 WM_LBUTTONUP = 0x202 WM_RBUTTONUP = 0x205 WM_MBUTTONUP = 0x208 WM_LBUTTONDBLCLK = 0x203 WM_RBUTTONDBLCLK = 0x206 WM_MBUTTONDBLCLK = 0x209
轉載于:https://my.oschina.net/cjkall/blog/195879
總結
以上是生活随笔為你收集整理的具有只读属性的ComboBox的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: (九)2005年我的第一次软件行业创业,
- 下一篇: Eclipse(STS) 初次搭建Spr