private void dataGridProgressBarColumn1_DataCellFormatParamsNeeded(object sender, DataGridProgressBarDataCellFormatParamsNeededEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            object val = e.Column.GetRowValue(e.Row);

            if (val is Decimal)
            {
                double dValue = (double)(Decimal)val;

                if (dValue > 100 / 4)
                {
                    double quota = (double)(((Decimal)val - 100 / 4) / (100 / 4 * 3) * 255);
                    if (quota > 255)
                    {
                        quota = 255;
                    }
                    e.CellArgs.BarFillColor = EhLibUtils.ApproximateColor(e.CellArgs.BarFillColor, Color.FromArgb(241, 171, 50), quota);
                }

                if (dValue > dataGridProgressBarColumn1.MaxValue)
                {
                    e.CellArgs.Font = boldProgressFont;
                }
            }
        }
Ejemplo n.º 2
0
        private void dataGridEh1_DataGrouping_GroupDescriptionsChanged(object sender, EventArgs e)
        {
            int cnt = dataGridEh1.DataGrouping.GroupDescriptions.Count;

            for (int i = 0; i < cnt; i++)
            {
                DataGridGroupDescription gd = dataGridEh1.DataGrouping.GroupDescriptions[i];
                int quota = 255 * i / cnt;
                gd.BackColor = EhLibUtils.ApproximateColor(Color.NavajoWhite, dataGridEh1.BackColor, quota);
            }
        }