这几天的工作用到了Winform的PropertyGrid,说说心得~
2004-12-27 14:38
435 查看
PropertyGrid的功能不用我多说了,看名字就可以知道个大概,在这里就谈谈它的一些功能使用。
假设目前有一个PropertyGrid控件PropTableColumn,那么进行属性绑定只需要一句话:
this.PropTableColumn.SelectedObject = ... ;
其中...表示需要进行绑定的对象,PropertyGrid使用的广泛性也主要体现在对象的设计上.
假设我们目前设置了一个类ABSControlsSettings用于绑定,代码如下:
public class ABSControlsSettings
private string _ControlID;
public string ControlID
private bool _Needcheck;
public bool Needcheck
private ControlTypeEnum _ControlType = ControlTypeEnum.Label;
public ControlTypeEnum ControlType
public enum ControlTypeEnum
private ListItemCollection _ValueList = new ListItemCollection();
public ListItemCollection ValueList
public class ListItem
public class ListItemCollection : System.Collections.CollectionBase
这些只是一些用户扩展部分的属性定义,还有一些系统级的属性可以直接设置,如Font设置颜色等,大家可以自己去试~
总的说来,PropertyGrid是一个弹性不错的控件,灵活使用可以让我们的UI更加容易操作~
假设目前有一个PropertyGrid控件PropTableColumn,那么进行属性绑定只需要一句话:
this.PropTableColumn.SelectedObject = ... ;
其中...表示需要进行绑定的对象,PropertyGrid使用的广泛性也主要体现在对象的设计上.
假设我们目前设置了一个类ABSControlsSettings用于绑定,代码如下:
public class ABSControlsSettings
private string _ControlID;
public string ControlID
private bool _Needcheck;
public bool Needcheck
private ControlTypeEnum _ControlType = ControlTypeEnum.Label;
public ControlTypeEnum ControlType
public enum ControlTypeEnum
private ListItemCollection _ValueList = new ListItemCollection();
public ListItemCollection ValueList
public class ListItem
public class ListItemCollection : System.Collections.CollectionBase
这些只是一些用户扩展部分的属性定义,还有一些系统级的属性可以直接设置,如Font设置颜色等,大家可以自己去试~
总的说来,PropertyGrid是一个弹性不错的控件,灵活使用可以让我们的UI更加容易操作~
相关文章推荐
- 编码规范与工作心得
- 说说工作
- 我的第一份工作心得
- 【探索发现】winform 网络传输时候封包与解包心得
- 11.11光棍节工作心得——github/MVP
- oracle中优化left join的工作心得
- 工作中用到的sql
- 记录工作中可能用到的--3 数据之间的转化
- 说说工作那点事,顺便推荐篇短文
- 【Excel】工作中会用到的excel操作和技巧
- 查找.net项目中用到的第三方库 - 心得
- PHP开发工作心得
- 十款在Web开发工作中经常会用到的插件
- 坐的越久,死的越快——说说工作环境
- 工作日志 Winmail升级安装心得
- 软件行业心得,软件工程师工作总结
- 关于winform第三方控件的一些心得
- 近期开发工作的一点心得体会
- 工作心得体会格式
- 工作心得