DesignerActionItem 为智能面板上的一项,我们要向智能面板上添加一项,只要实例化一个DesignerActionItem,DesignerActionList类里有个 可以被override的方法GetSortedActionItems()返回类型为DesignerActionItemCollection,它实 际上就是返回智能面板上项的集合,我们只要把DesignerActionItem实例添加到GetSortedActionItems()的返回值即 可。
在.net中DesignerActionMethodItem、DesignerActionPropertyItem、 DesignerActionTextItem、DesignerActionHeaderItem继承于DesignerActionItem,它们的 成员大部分都是相同的,DesignerActionMethodItem主要在智能面板上生成一个方法项,点击这个项会去执行相应的方法; DesignerActionPropertyItem则把Component的属性显示在智能面板上,用户可以在职能面板上对Component的属性 进行设置和修改;DesignerActionTextItem是在智能面板上生成一个文本项;而DesignerActionHeaderItem是继 承于DesignerActionTextItem,但它多了分组的功能。
代码演示如下:
效果如下:
如果大家有什么问题,请给我留言、或者评论。