2010-11-14 33 views
0
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中顯示多個對象,我做錯了什麼?在屬性網格中顯示多個對象

+0

以何種方式是不工作? – 2010-11-14 08:58:06

+0

它不顯示屬性,它顯示它自己的數組。我從VB.NET轉換了代碼。在VB中它的工作,但在C#中的某個地方是動搖的錯誤。在VB.NET中,我只是能夠做到.SelectedObjects =選中,但在C#中它提供了一個編譯器錯誤,所以我不得不改變.SelectedObjects = new object [] {selected}。它編譯但不起作用。 – 2010-11-14 09:06:19

回答

0

發現我的回答我:)

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

做工作;)