前些天,由于在项目中需要用到PropertyGrid这个控件,展现其所在控件的某些属性,由于有些控件的属性较多,不易浏览,而且PropertyGrid的排序默认的按照字母的顺序排列的,这样导致在在某些属性想要排在第一位非常不方便,于是我总结了网友们的一些思路,自己便解决呢!现在来说说解决思路:
1.首先为PropertyGrid添加SelectedObjectsChanged事件!
1 private void propertyGrid_flow_SelectedObjectsChanged(object sender, EventArgs e) 2 { 3 propertyGrid_flow.Tag = propertyGrid_flow.PropertySort; 4 propertyGrid_flow.PropertySort = PropertySort.CategorizedAlphabetical; 5 propertyGrid_flow.Paint += new PaintEventHandler(propertyGrid_flow_Paint); 6 }