gridView水平滚动条:
this.gridView1.OptionsView.ColumnAutoWidth = false;//自动列宽无效,同时出现水平滚动条
gridView显示行号,gridView的CustomDrawRowIndicator事件中处理,把IndicatorWidth设置一个宽度,也可在Load事件中加入this.gridView1.IndicatorWidth = 65;
//也可在Load事件中加入this.gridView1.IndicatorWidth = 65;
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) { e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; if (e.Info.IsRowIndicator) { if (e.RowHandle >= 0) { e.Info.DisplayText = (e.RowHandle + 1).ToString(); } else if (e.RowHandle < 0 && e.RowHandle > -1000) { e.Info.Appearance.BackColor = System.Drawing.Color.AntiqueWhite; e.Info.DisplayText = "G" + e.RowHandle.ToString(); } } }
GridControl.DataSouce = dt;绑定数据表后在GridView表中不显示数据
string sql = string.Format("select * from tb_Details where ID='{0}'",ID); dt = SqlHelper.ExecuteReader(SqlHelper.ConnStr, CommandType.Text, sql); this.gridControl1.DataSource = dt.DefaultView; this.gridControl1.RefreshDataSource();//加上这句就显示出来了
持续更新记录中....