• UltraGrid常用方法属性代码


    一、UltraGrid更换行背景色

    private void dxGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e)
            {
                foreach (UltraGridRow row in this.dxGrid.Rows)
                {
                    if (row.Cells["IsAllowEdit"].Value.ToString() == "True")
                    {
                        row.Appearance.BackColor = Color.LightBlue;
                    }
                    if (row.Cells["ConfirmPayApproveID"].Value.ToString() == "3")
                    {
                        row.Appearance.BackColor = Color.LightGreen;
                    }               
                }
            }

    二、UltraGrid多表头代码设置

                    DateTime currentDateTime=base.GetServerTime();        //当前时间
                    DateTime currentStartMonth = currentDateTime.AddDays(1 - currentDateTime.Day);   //本月月初
                    DateTime lastStartMonth1 = currentStartMonth.AddMonths(-3);       //前三月月初
                    DateTime lastStartMonth2 = currentStartMonth.AddMonths(-2);       //前二月月初
                    DateTime lastStartMonth3 = currentStartMonth.AddMonths(-1);       //前一月月初
                    this.dxGrid.DisplayLayout.Bands[0].Columns["自驾"].RowLayoutColumnInfo.LabelPosition = LabelPosition.LabelOnly;
                    this.dxGrid.DisplayLayout.Bands[0].Columns["代驾"].RowLayoutColumnInfo.LabelPosition = LabelPosition.LabelOnly;

                    this.dxGrid.DisplayLayout.Bands[0].Columns["SelfDriveFisrtMonthAMount"].Header.Caption =lastStartMonth1.ToString("yyyy年MM月");
                    this.dxGrid.DisplayLayout.Bands[0].Columns["SelfDriveSecondMonthAMount"].Header.Caption = lastStartMonth2.ToString("yyyy年MM月");
                    this.dxGrid.DisplayLayout.Bands[0].Columns["SelfDriveThirdMonthAMount"].Header.Caption = lastStartMonth3.ToString("yyyy年MM月");
                    this.dxGrid.DisplayLayout.Bands[0].Columns["SelfDriveAllMonthAMount"].Header.Caption = "合计";

                    this.dxGrid.DisplayLayout.Bands[0].Columns["ChauffeurDirveFisrtMonthAMount"].Header.Caption = lastStartMonth1.ToString("yyyy年MM月");
                    this.dxGrid.DisplayLayout.Bands[0].Columns["ChauffeurDirveSecondMonthAMount"].Header.Caption = lastStartMonth2.ToString("yyyy年MM月");
                    this.dxGrid.DisplayLayout.Bands[0].Columns["ChauffeurDirveThirdMonthAMount"].Header.Caption = lastStartMonth3.ToString("yyyy年MM月");
                    this.dxGrid.DisplayLayout.Bands[0].Columns["ChauffeurDirveAllMonthAMount"].Header.Caption = "合计";

                    for (int i = 0; i < this.dxGrid.DisplayLayout.Bands[0].Columns.Count; i++)
                    {
                        this.dxGrid.DisplayLayout.Bands[0].Columns[i].Header.Appearance.TextVAlign = Infragistics.Win.VAlign.Middle;
                        this.dxGrid.DisplayLayout.Bands[0].Columns[i].Header.Appearance.TextHAlign = Infragistics.Win.HAlign.Center;
                    }

  • 相关阅读:
    P5047 [Ynoi2019 模拟赛] Yuno loves sqrt technology II
    P4887 【模板】莫队二次离线(第十四分块(前体))
    SP20644 ZQUERY
    企业战略管理【0612】
    管理经济学【0812】
    商务沟通[0664]
    国际企业管理【0813】
    社区管理【0272】
    战略管理【1059】
    管理沟通【1279】
  • 原文地址:https://www.cnblogs.com/xqf222/p/3306811.html
Copyright © 2020-2023  润新知