コード例 #1
0
 /// <summary>
 /// 当全局样式发生变化时调用
 /// </summary>
 public void OnSetRowColor(object p_RowObject, _SchemeColor p__SchemeColor, DevExpress.Utils.AppearanceObject appearance)
 {
     if (this.SetRowColorChange != null)
     {
         this.SetRowColorChange(p_RowObject, p__SchemeColor, appearance);
     }
 }
コード例 #2
0
ファイル: BandedGridViewEx.cs プロジェクト: shansheng/QDJJ
        /// <summary>
        /// 当默认配色执行完毕后调用特殊配色方案
        /// </summary>
        /// <param name="e"></param>
        private void SetRowColor(int rowHandle, DevExpress.Utils.AppearanceObject appearance)
        {
            //类别颜色配置

            object oRowObject = this.GetRow(rowHandle);

            System.Data.DataRowView info = (oRowObject as System.Data.DataRowView);
            if (info != null)
            {
                //取类别

                if (this.m_SchemeColor != null)
                {
                    appearance.BeginUpdate();
                    _SpecialStyleInfo style = this.m_SchemeColor.SpecialStyle.Get(info["LB"].ToString());
                    if (style != null)
                    {
                        appearance.Font = new Font(appearance.Font.FontFamily, appearance.Font.Size, style.Font);
                        //字体颜色
                        appearance.ForeColor = style.ForeColor.IsEmpty ? appearance.ForeColor : style.ForeColor;
                        //背景颜色
                        appearance.BackColor = style.BColor.IsEmpty ? appearance.BackColor : style.BColor;

                        appearance.BackColor2 = style.BColor2.IsEmpty ? appearance.BackColor2 : style.BColor2;

                        this.OnSetRowColor(oRowObject, this.m_SchemeColor, appearance);
                        appearance.EndUpdate();
                    }
                }
            }
        }
コード例 #3
0
ファイル: BandedGridViewEx.cs プロジェクト: shansheng/QDJJ
        protected override DevExpress.Utils.AppearanceObject RaiseGetRowStyle(int rowHandle, DevExpress.XtraGrid.Views.Base.GridRowCellState state, DevExpress.Utils.AppearanceObject appearance, out bool highPriority)
        {
            AppearanceObject ao = base.RaiseGetRowStyle(rowHandle, state, appearance, out highPriority);

            //若为空使用系统颜色(不使用特殊配色)
            if (this.m_SchemeColor == null)
            {
                return(ao);
            }

            if (this.m_SchemeColor.GridStyle == null)
            {
                return(ao);
            }


            bool b_1 = ((state & DevExpress.XtraGrid.Views.Base.GridRowCellState.Even) != 0);
            bool b_2 = ((state & DevExpress.XtraGrid.Views.Base.GridRowCellState.Odd) != 0);

            //object obj = this.m_SchemeColor.GridStyle.Get();

            //GridViewAppearances gva = obj as GridViewAppearances;
            if (this.m_GridViewAppearances != null)
            {
                if (b_1)
                {
                    ao.Assign(this.m_GridViewAppearances.EvenRow);
                }
                if (b_2)
                {
                    ao.Assign(this.m_GridViewAppearances.OddRow);
                }
            }

            if (this.m_UseSpecialColor)
            {
                //奇数偶数都做此操作
                if (b_1 || b_2)
                {
                    this.SetRowColor(rowHandle, ao);
                }
            }
            //AppearanceObject ao = base.RaiseGetRowStyle(rowHandle, state, appearance, out highPriority);
            //return base.RaiseGetRowStyle(rowHandle, state, appearance, out highPriority);
            return(ao);
        }