System.Windows.Forms.DataGridViewComboBoxCell.Paint(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, int, System.Windows.Forms.DataGridViewElementStates, object, object, string, System.Windows.Forms.DataGridViewCellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle, System.Windows.Forms.DataGridViewPaintParts)

Here are the examples of the csharp api class System.Windows.Forms.DataGridViewComboBoxCell.Paint(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, int, System.Windows.Forms.DataGridViewElementStates, object, object, string, System.Windows.Forms.DataGridViewCellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle, System.Windows.Forms.DataGridViewPaintParts) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

View license
protected override void Paint(Graphics graphics,
                                  Rectangle clipBounds, Rectangle cellBounds, int rowIndex,
                                  DataGridViewElementStates elementState, object value,
                                  object formattedValue, string errorText,
                                  DataGridViewCellStyle cellStyle,
                                  DataGridViewAdvancedBorderStyle advancedBorderStyle,
                                  DataGridViewPaintParts paintParts)
    {
      //Call the base to draw the combo box itself.
      base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, null,
                 errorText, cellStyle, advancedBorderStyle, paintParts);

      //Now we will draw the current content of the box.
      DataGridViewImageComboBoxColumn column = ((DataGridViewImageComboBoxColumn)OwningColumn);
      if((paintParts & DataGridViewPaintParts.Background) != 0 || (paintParts & DataGridViewPaintParts.All) != 0)
      {
        Rectangle rect = new Rectangle(cellBounds.X + 4, cellBounds.Y, cellBounds.Width - 4, cellBounds.Height - 1);
        ControlDrawHelper.DrawImageComboBoxItem(graphics, value, column.ImageList, column.ImageSize, rect, cellStyle.Font, cellStyle.ForeColor);
      }
    }

2. Example

View license
protected override void Paint(Graphics graphics,
                                  Rectangle clipBounds, Rectangle cellBounds, int rowIndex,
                                  DataGridViewElementStates elementState, object value,
                                  object formattedValue, string errorText,
                                  DataGridViewCellStyle cellStyle,
                                  DataGridViewAdvancedBorderStyle advancedBorderStyle,
                                  DataGridViewPaintParts paintParts)
    {
      //Call the base to draw the combo box itself.
      base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, null,
                 errorText, cellStyle, advancedBorderStyle, paintParts);

      //Now we will draw the current content of the box.
      DataGridViewImageComboBoxColumn column = ((DataGridViewImageComboBoxColumn)OwningColumn);
      if((paintParts & DataGridViewPaintParts.Background) != 0 || (paintParts & DataGridViewPaintParts.All) != 0)
      {
        Rectangle rect = new Rectangle(cellBounds.X + 4, cellBounds.Y, cellBounds.Width - 4, cellBounds.Height - 1);
        ControlDrawHelper.DrawImageComboBoxItem(graphics, value, column.ImageList, column.ImageSize, rect, cellStyle.Font, cellStyle.ForeColor);
      }
    }