Exemple #1
0
 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     if (folderListItem != null)
     {
         folderListItem.DrawSelf(e.Graphics, new Rectangle(0, 2, Width, Height), false);
     }
 }
 protected override void OnPaint(PaintEventArgs pevent)
 {
     base.OnPaint(pevent);
     if (folderListItem != null)
     {
         Rectangle r = pevent.ClipRectangle;
         r.Location = new Point(6, 4);
         r.Width   -= 21;
         r.Height  -= 6;
         folderListItem.DrawSelf(pevent.Graphics, r, false);
     }
 }
        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex,
                                      DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle,
                                      DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            using (SolidBrush cellBackground = new SolidBrush(Selected ? cellStyle.SelectionBackColor : cellStyle.BackColor))
            {
                graphics.FillRectangle(cellBackground, cellBounds);
            }

            Rectangle bounds = cellBounds;

            bounds.Offset(cellStyle.Padding.Left, cellStyle.Padding.Top);
            bounds.Width            -= cellStyle.Padding.Horizontal;
            bounds.Height           -= cellStyle.Padding.Vertical;
            folderListItem.ForeColor = Selected ? cellStyle.SelectionForeColor : cellStyle.ForeColor;
            folderListItem.DrawSelf(graphics, bounds, false);
        }