在属性网格中显示多个对象

时间:2010-11-14 08:52:56

标签: c# winforms

Array selected = Array.CreateInstance(typeof(Object), (this.designer1.DesignerHost.GetService(typeof(ISelectionService)) as ISelectionService).SelectionCount);
(this.designer1.DesignerHost.GetService(typeof(ISelectionService)) as ISelectionService).GetSelectedComponents().CopyTo(selected, 0);
_PropertyGrid.SelectedObjects = new object[] {selected};

我试图在PropertyGrid中显示多个对象,我做错了什么?

1 个答案:

答案 0 :(得分:1)

我自己找到答案:)

_PropertyGrid.SelectedObjects = (selected as object[]);

完成工作;)