DevExpress 자동 매 칭 너비 및 기타 사용 노트

6342 단어 DevExpress
발췌: http://blog.sina.com.cn/s/blog_53b58e7c0101avl4.html
  GridControl       
2011-02-13 22:24 327      (0)      
//          
this.gridView1.BestFitColumns();
//        
this.gridView1.Columns[n].BestFit();


DevExpress   GridControl    
          ,                。

 

XtraGrid      :GridControl GridView。GridControl       ,       GridView/CardView/XXXXView 。GridControl   View   。       ,  GridView     。

 

1.DevExpress     GridControl            。  :            ,       ,                 。

  :

gridView1.OptionsView.ColumnAutoWidth   true,          ,     false,     。


2.        。

gridcontrol -->gridview -->OptionsBehavior -->Editable=false

 

3.  "Drag a Column Header Here To Group by that Column"

  Gridview->Option View->Show Group Panel=false,   

 

4.    

(1)  GridControl       

(2)        ,            。          ,    ,    。              Caption         FieldName            ,Visible       。

 

    :

gridControl2.DataSource = od.data_select("select * from tablename").Tables[0];//od       ,data_select  DataSet  ,  DataTable  

 

5.          

gridView2.RowClick += new DevExpress.XtraGrid.Views.Grid.RowClickEventHandler(gridView2_RowClick);

                        ,    gridcontrol -->gridview -->OptionsBehavior -->Editable=false             。

 

6.             

this.textBox1.Text = gridView2.GetDataRow(e.RowHandle)["  "].ToString();

 

7.   、      

(1) OptionsView.EnableAppearanceEvenRow = true;OptionsView.EnableAppearanceOddRow = true;

(2)   Appearance.EvenRow.BackColor Appearance.OddRow.BackColor

 

8.          

(1this.gridView2.IndicatorWidth = 30;//         
2)     gridView2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView2_CustomDrawRowIndicator);

?
1
2
3
4
5
6
7
8

//    

        void gridView2_CustomDrawRowIndicator(object sender,
DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs
e)

        {

            if(e.Info.IsRowIndicator
&& e.RowHandle >=
0)

            {

                e.Info.DisplayText
= (e.RowHandle + 1).ToString();

            }

        }
 

 

9.             

gridView2.PopulateColumns();

좋은 웹페이지 즐겨찾기