惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

博客园 - james.dong

初次使用T4引擎生成数据库表实体 - james.dong - 博客园 加快大表关联查询的速度(oracle) DataTable 排序 - james.dong - 博客园 查询oracle数据库中所有视图和表的信息 日期验证正规表达式( YYYY-MM-DD YYYY-MM-DD hh:mm:ss YYYY/MM/DD) windows2000server下 iis 无法下载 .exe , .dll文件的解决办法。 - james.dong C#中datagridview使用技巧系列谈(-)让输入焦点从左到右收藏 oracle中创建自增字段 .net 序列化和反序列化自定义treenode类 LotusScript基础知识(二) LotusScript基本语法知识(一) LotusScript中Option 的含义 Lotusscript中Instr()函数的功能和用法 System.Xml.XmlDocument.SelectNodes() 查询不到节点问题? - james.dong - 博客园 WPF 中的 BitmapEffect 的 各种样式 WPF相关文章汇总 使用List泛型,怎么排序 asp.net2.0解决用户控件图片相对路径出错的问题,ResolveUrl的用法 window.showModalDialog()时没有显示修改后的数据 - james.dong - 博客园
Combox控件实现类似TextBox控件的ReadOnly=true时的背景颜色和字体颜色!(WinForm)
james.dong · 2008-10-25 · via 博客园 - james.dong

想将一个ComboBox变成不可用,设置Enable成False虽然简单,但文字变成灰色了。
不知道怎么能让ComboBox不可用,而现实的文字还是黑色的,就类似TextBox的ReadOnly设置成True那样。

public class m_ComboBox : ComboBox   { 

  private bool _ReadOnle; 

  public m_ComboBox() 
  { 
  this._ReadOnle = true; 
  this.DropDownStyle = ComboBoxStyle.DropDownList; 
  this.TabStop = false; 
  } 

  public bool ReadOnly 
  { 
  get 
  { 
  return this._ReadOnle; 
  } 
  set 
  { 
  this._ReadOnle = value; 
  } 
  } 

  protected override void WndProc(ref Message m) 
  { 
  if (this._ReadOnle && (m.Msg == 0xa1 || m.Msg == 0x201 || m.Msg == 0x203)) 
  { 
  return; 
  } 
  base.WndProc(ref m); 
  }  
  }