博客
关于我
设置控件Enable=false,控件颜色不变
阅读量:419 次
发布时间:2019-03-06

本文共 658 字,大约阅读时间需要 2 分钟。

using System.Runtime.InteropServices;  public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int wndproc); 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(button1, false); button1.ForeColor = Color.White; }

 

转载地址:http://rcvkz.baihongyu.com/

你可能感兴趣的文章
Openlayers实战:加载geoserver发布的WMS数据
查看>>
Openlayers实战:加载GPX文件
查看>>
Openlayers实战:加载OpenStreetMap(快速显示无加载不出状态)
查看>>
Openlayers实战:加载SHP文件
查看>>
Openlayers实战:加载高德地图
查看>>
Openlayers实战:双击鼠标显示信息名片
查看>>
Openlayers实战:右键点击,弹出feature信息
查看>>
Openlayers实战:地图上显示经纬度坐标
查看>>
Openlayers实战:多数据分散聚合
查看>>
Openlayers实战:显示海量数据
查看>>
Openlayers实战:水电站管道站点信息管理示例
查看>>
Openlayers实战:测量长度,测量面积
查看>>
Openlayers实战:点击某点,overlay显示经纬度坐标
查看>>
Openlayers实战:界面控制综合演示
查看>>
Openlayers实战:移动鼠标至重叠几何图形上,获取多层所有features信息
查看>>
Openlayers实战:绘制图形,导出geojson文件
查看>>
Openlayers实战:绘制图形,导出KML文件
查看>>
Openlayers实战:绘制多边形,导出CSV文件
查看>>
Openlayers实战:绘制带箭头的线
查看>>
Openlayers实战:绘制点、线、圆、多边形
查看>>