3
有沒有什麼辦法可以自定義Winforms PropertyGrid,如果它需要在頂部(全行)顯示一個沒有類別的元素和幾個元素在下面的元素?WinForms PropertyGrid具有空的和非空的類別
有沒有什麼辦法可以自定義Winforms PropertyGrid,如果它需要在頂部(全行)顯示一個沒有類別的元素和幾個元素在下面的元素?WinForms PropertyGrid具有空的和非空的類別
using System;
using System.ComponentModel;
using System.Windows.Forms;
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
using (var form = new Form {
Controls = {
new PropertyGrid { Dock = DockStyle.Fill,
SelectedObject = new Test {
Foo = "one element without category",
Bar = "several categories",
Blip = "with elements",
Blap = "inside",
Blop = "below"
}}}}) {
Application.Run(form);
}
}
}
class Test {
[Category(" ")] public string Foo { get; set; }
[Category("x")] public string Bar{ get; set; }
[Category("x")] public string Blip { get; set; }
[Category("y")] public string Blap { get; set; }
[Category("y")] public string Blop { get; set; }
}
不,它會以string.Empty作爲名稱創建類別。讓我用鏈接http://xmages.net/storage/10/1/0/7/d/upload/5ec8a40d.png解釋 - 在類別中有一個Prop1,但我想顯示沒有任何類別的Prop1(一個級別向上)。 – 2010-12-01 07:58:45