propertyGrid展开的问题 默认的每个分类下的属性都是展开的因为属性过多所以默认的情况下,不让某个分类展开这个怎么实现谢谢各位 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.propertyGrid1.SelectedObject = this; ExpandFirstCategoryOnly(); } private void ExpandFirstCategoryOnly() { this.propertyGrid1.CollapseAllGridItems(); GridItemCollection gridItems = GetGridItems(this.propertyGrid1); if( gridItems.Count > 0 ) { gridItems[0].Expanded = true; } } private static GridItemCollection GetGridItems(PropertyGrid grid) { GridItemCollection result = typeof(PropertyGrid).InvokeMember( "GetPropEntries", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, grid, new object[] { } ) as GridItemCollection; return result ?? GridItemCollection.Empty; } } ListBox的项,为什么要闪烁啊 mvc 正则验证 自定义控件如何重置继承控件的属性 關於數據庫 请问为什么不能触发事件? [[ 散分 ]]怎么我的可用分不见增长,虽然我每天登陆 c#关于静态变量的问题,急! WinForm嵌入仿word控件提供下载(只有基本功能) 怎么样在WinForm中播放声音? 从数据库读取一个数据怎么这么难的捏。 查找指定文件夹 C#绘图中,如何实现橡皮线的效果。
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
this.propertyGrid1.SelectedObject = this;
ExpandFirstCategoryOnly();
} private void ExpandFirstCategoryOnly()
{
this.propertyGrid1.CollapseAllGridItems(); GridItemCollection gridItems = GetGridItems(this.propertyGrid1);
if( gridItems.Count > 0 )
{
gridItems[0].Expanded = true;
}
} private static GridItemCollection GetGridItems(PropertyGrid grid)
{
GridItemCollection result = typeof(PropertyGrid).InvokeMember(
"GetPropEntries",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod,
null, grid, new object[] { }
) as GridItemCollection; return result ?? GridItemCollection.Empty;
}
}