• DevExpress控件GridView使用方法记录


    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();//加上这句就显示出来了

    持续更新记录中....

  • 相关阅读:
    内存初始化
    时钟初始化
    auto,register,static分析
    基本数据类型
    LED驱动简单设计
    核心初始化程序
    核心初始化基本介绍
    链接器脚本
    !带有指针的类和struct赋值的本质
    添加thrust的库后出错
  • 原文地址:https://www.cnblogs.com/coreybrans/p/3579629.html
Copyright © 2020-2023  润新知