首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

PropertyGrid的ResetSelectedProperty没有重置到初始值,如何破

2013-09-18 
求助:PropertyGrid的ResetSelectedProperty没有重置到初始值,怎么破?PropertyGrid _propGrid new Proper

求助:PropertyGrid的ResetSelectedProperty没有重置到初始值,怎么破?

            
            PropertyGrid _propGrid = new PropertyGrid();

            _propGrid.SelectedObject = obj;
            _propGrid.Size = tabControl_prop.Size;

            _propGrid.PropertySort = PropertySort.NoSort;

            tabControl_prop.TabPages[tabControl_prop.TabPages.Count - 1].Controls.Add(_propGrid);


属性页是自定义的obj,怎样能够放弃对属性页的编辑改动,恢复到赋给SelectedObject时候obj所具有的值。
我使用ResetSelectedProperty没有效果,还有其他方法实现这个功能么?
求助! PropertyGrid
[解决办法]
没这个功能。

ResetSelectedProperty工作的前提是,这个属性有一个DefualtValue 的 Attribute

http://msdn.microsoft.com/zh-cn/library/system.componentmodel.defaultvalueattribute(v=vs.90).ASPX

热点排行