Exemple #1
0
        private void pivotGridControl1_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e)
        {
            int index = 0;

            PivotGridField[] fields = e.GetRowFields();
            for (int i = 0; i < fields.Length; i++)
            {
                if (fields[i].Caption == BalanceTableViewData.CATEGORY)
                {
                    index = i; break;
                }
            }

            if (index >= 0 && fields.Length > index)
            {
                if (e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_IN_BALANCE) ||
                    e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_OUT_BALANCE)
                    )
                {
                    e.Appearance.BackColor            = Color.PowderBlue;
                    e.Appearance.BackColor2           = Color.PowderBlue;
                    e.Appearance.Options.UseBackColor = true;
                }
                else if (e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_IN_TARGET) ||
                         e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_OUT_TARGET)
                         )
                {
                    e.Appearance.BackColor            = Color.WhiteSmoke;
                    e.Appearance.BackColor2           = Color.WhiteSmoke;
                    e.Appearance.Options.UseBackColor = true;
                }
                else if (e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_IN_PLAN) ||
                         e.GetFieldValue(fields[index]).ToString().StartsWith(CellInfo.CELL_OUT_PLAN)
                         )
                {
                    e.Appearance.BackColor            = Color.WhiteSmoke;
                    e.Appearance.BackColor2           = Color.WhiteSmoke;
                    e.Appearance.Options.UseBackColor = true;
                }
            }

            index = 0;

            // 색상 변경 : 특정 Data Cell : 색상 처리
            if (e.DataField.FieldName == BalanceTableViewData.QTY && (decimal)e.GetFieldValue(e.DataField) < 0)
            {
                e.Appearance.Options.UseBackColor = true;
                e.Appearance.DrawBackground(e.GraphicsCache, e.Bounds);
                e.Appearance.DrawString(e.GraphicsCache, e.DisplayText, e.Bounds, e.Appearance.Font, Brushes.Red, e.Appearance.GetStringFormat());
                e.Handled = true;
            }
        }
Exemple #2
0
        private void pivotGridControl1_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e)
        {
            int index = 0;

            PivotGridField[] fields = e.GetRowFields();
            for (int i = 0; i < fields.Length; i++)
            {
                if (fields[i].Caption == TargetPlanCompareData.CATEGORY)
                {
                    index = i; break;
                }
            }

            if (e.Value != null && (decimal)e.GetFieldValue(e.DataField) < 0)
            {
                e.Appearance.Options.UseBackColor = true;
                //e.Appearance.BackColor = Color.Yellow;
                //e.Appearance.BackColor2 = Color.Yellow;
                e.Appearance.ForeColor = Color.Red;
            }

            index = 0;

            for (int i = 0; i < fields.Length; i++)
            {
                if (fields[i].Caption == "FACTORY")
                {
                    index = i; break;
                }
            }

            if (index >= 0 && fields.Length > index && e.GetFieldValue(fields[index]).ToString().StartsWith(TargetPlanCompareData.TOTAL))
            {
                e.Appearance.BackColor            = Color.LightGreen;
                e.Appearance.BackColor2           = Color.LightGreen;
                e.Appearance.Options.UseBackColor = true;
            }

            //if (index >= 0 && fields.Length > index && e.GetFieldValue(fields[index]).ToString().StartsWith("Plan"))
            //{
            //    e.Appearance.BackColor = Color.Gainsboro;
            //    e.Appearance.BackColor2 = Color.Gainsboro;
            //    e.Appearance.Options.UseBackColor = true;
            //}
        }