Beispiel #1
0
 private void dgMonitorEditorView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
 {
     if (e.RowIndex < 0 || e.ColumnIndex < 0)
     {
         GridViewHelper.DataGridViewCellPainting(e);
     }
 }
Beispiel #2
0
 private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && e.Value != null)
     {
         Rectangle rect = e.CellBounds;
         if (e.Value.GetType() == typeof(Color))
         {
             e.Handled = true;
             e.PaintBackground(e.ClipBounds, true);
             rect.Inflate(-10, -5);
             e.Graphics.FillRectangle(new SolidBrush((Color)e.Value), rect);
         }
     }
     else if (e.RowIndex < 0 || e.ColumnIndex < 0)
     {
         GridViewHelper.DataGridViewCellPainting(e);
     }
 }