C# DevExpress_gridControl 行号行样式

        #region 行号
        /// <summary>
        /// 行号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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();
                }
            }
        }
        #endregion

        #region gridView 行样式
        /// <summary>
        /// gridView 行样式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            if (e.RowHandle < 0) return;
            models.info info = (models.info)this.gridView1.GetRow(e.RowHandle);
            if (info == null) return;
            if (info.status == "-1" || info.status == "1")
            {
                //e.Appearance.ForeColor = Color.Yellow;
                e.Appearance.BackColor = Color.Yellow;
                e.Appearance.BackColor2 = Color.Yellow;
            }
        }
        #endregion

 

你可能感兴趣的:(C# DevExpress_gridControl 行号行样式)