Beispiel #1
0
        private void dpTable_items_PaintBack(object sender, PaintBackArgs e)
        {
            if (!(e.Item is DpRow))
            {
                if (e.Item is DpCell)
                {
                    DpCell cell = e.Item as DpCell;

                    if (cell.BackColor != Color.Transparent)
                    {
                        using (Brush brush = new SolidBrush(cell.BackColor))
                        {
                            e.pe.Graphics.FillRectangle(brush, e.Rect);
                        }
                    }
                }
                return;
            }

            DpRow row = e.Item as DpRow;

            bool bGray = IsGray(row);

            if (row.Selected == true)
            {
                if (row.Control.Focused == true)
                {
                    using (Brush brush = new SolidBrush(
                               bGray ? Color.FromArgb(240, 240, 240) : row.Control.HighlightBackColor
                               ))
                    {
                        e.pe.Graphics.FillRectangle(brush, e.Rect);
                    }
                }
                else
                {
                    // textColor = SystemColors.InactiveCaptionText;
                    using (Brush brush = new SolidBrush(
                               bGray ? Color.FromArgb(240, 240, 240) : row.Control.InactiveHighlightBackColor
                               ))
                    {
                        e.pe.Graphics.FillRectangle(brush, e.Rect);
                    }
                }
            }
            else
            {
                if (row.BackColor != Color.Transparent)
                {
                    using (Brush brush = new SolidBrush(
                               row.Control.BackColor
                               ))
                    {
                        e.pe.Graphics.FillRectangle(brush, e.Rect);
                    }
                }
            }
        }
Beispiel #2
0
        private void dpTable_items_PaintBack(object sender, PaintBackArgs e)
        {
            if (!(e.Item is DpRow))
            {
                if (e.Item is DpCell)
                {
                    DpCell cell = e.Item as DpCell;

                    if (cell.BackColor != Color.Transparent)
                    {
                        e.pe.Graphics.FillRectangle(new SolidBrush(
                            cell.BackColor
                            ), e.Rect);
                    }
                }
                return;
            }

            DpRow row = e.Item as DpRow;

            bool bGray = IsGray(row);

            if (row.Selected == true)
            {
                if (row.Control.Focused == true)
                {

                    e.pe.Graphics.FillRectangle(new SolidBrush(
                        bGray ? Color.FromArgb(240,240,240) : row.Control.HighlightBackColor
                        ), e.Rect);
                }
                else
                {
                    // textColor = SystemColors.InactiveCaptionText;

                    e.pe.Graphics.FillRectangle(new SolidBrush(
                        bGray ? Color.FromArgb(240, 240, 240) : row.Control.InactiveHighlightBackColor
                        ), e.Rect);
                }
            }
            else
            {
                if (row.BackColor != Color.Transparent)
                {
                    e.pe.Graphics.FillRectangle(new SolidBrush(
                        row.Control.BackColor
                        ), e.Rect);
                }
            }
        }
Beispiel #3
0
        private void dpTable1_PaintBack(object sender, PaintBackArgs e)
        {
            if (e.Item is DpRow)
            {
                DpRow row = e.Item as DpRow;
                row.PaintBackground(e.pe.Graphics, e.Rect);
                return;
            }

            DpCell cell = e.Item as DpCell;
            if (cell == null)
            {
                // Debug.Assert(false, "");
                return;
            }
            if (cell.OwnerDraw == false)
                return;

            bool bSelected = cell.Container.Selected;
            // cell.PaintBackground(e.pe.Graphics, e.Rect, cell.Container.Selected);

            int nLevel = Int32.Parse(cell.Container[COLUMN_LEVEL].Text);

            // 绘制下划线
            RelationControl.PaintSourceTextUnderline(e.pe.Graphics,
                this.dpTable1.Font,
                bSelected ? Color.LightGreen : Color.DarkGreen,
                e.Rect.X + 2,
                e.Rect.Y + e.Rect.Height - 2,
                cell.Text,
                nLevel);
        }