winform禁用控件,但不让控件变为灰色
来源:互联网 发布:退货还给淘宝客佣金吗 编辑:程序博客网 时间:2024/06/03 17:03
[System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int wndproc); [System.Runtime.InteropServices.DllImport("user32.dll ")] public static extern int GetWindowLong(IntPtr hWnd, int nIndex); public const int GWL_STYLE = -16; public const int WS_DISABLED = 0x8000000; public static void SetControlEnabled(Control c, bool enabled) { if (enabled) { SetWindowLong(c.Handle, GWL_STYLE, (~WS_DISABLED) & GetWindowLong(c.Handle, GWL_STYLE)); } else { SetWindowLong(c.Handle, GWL_STYLE, WS_DISABLED + GetWindowLong(c.Handle, GWL_STYLE)); } } private void button2_Click(object sender, System.EventArgs e) { SetControlEnabled(this.button1, false); this.button1.ForeColor = Color.White; }
http://bbs.csdn.net/topics/350241687
1 0
- winform禁用控件,但不让控件变为灰色
- C# winform 中控件禁用,但是不变灰
- vs工具箱控件灰色
- WinForm控件
- 在页面控件TextBox禁用的情况下将文本字体颜色变为黑色
- jstree树形控件显示灰色
- Qt ActiveX控件为灰色
- C#日期控件变为时间控件
- 禁用页面所有控件
- 禁用页面控件
- JS 禁用畫面驗證控件
- 启用和禁用控件
- 控件禁用的方式
- 如何让流程表单禁用选人控件,但可以通过代码赋值?
- WinForm基础控件--文本控件
- 如何不让键盘挡住UITextField控件
- 如何不让键盘挡住UITextField控件
- 如何不让键盘挡住UITextField控件
- Tricks(四十二)—— 数据集分块
- 断言assert,和#define NDBUG 学习小结
- NTFS For Mac设置说明
- HDU 3549 —— Flow Problem
- 从此不求人:自主研发一套PHP前端开发框架(28)
- winform禁用控件,但不让控件变为灰色
- 如何理解并正确使用python中的self init
- 个人hbase编程遇到的问题
- linux下Memcache服务器端的安装
- MTK平台如何快速对系统重启问题进行归类
- ubuntu 64位 出现 error executing aapt 错误
- Myeclipse中如何新建maven项目
- Android屏幕适配
- 初入greadle