DataGridViewCell.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size) DataGridViewCell.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size) DataGridViewCell.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size) Method

Definición

Calcula el tamaño preferido, en píxeles, de la celda.Calculates the preferred size, in pixels, of the cell.

protected:
 virtual System::Drawing::Size GetPreferredSize(System::Drawing::Graphics ^ graphics, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, int rowIndex, System::Drawing::Size constraintSize);
protected virtual System.Drawing.Size GetPreferredSize (System.Drawing.Graphics graphics, System.Windows.Forms.DataGridViewCellStyle cellStyle, int rowIndex, System.Drawing.Size constraintSize);
abstract member GetPreferredSize : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int * System.Drawing.Size -> System.Drawing.Size
override this.GetPreferredSize : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int * System.Drawing.Size -> System.Drawing.Size

Parámetros

graphics
Graphics Graphics Graphics

Graphics que se utiliza para dibujar la celda.The Graphics used to draw the cell.

cellStyle
DataGridViewCellStyle DataGridViewCellStyle DataGridViewCellStyle

DataGridViewCellStyle que representa el estilo de la celda.A DataGridViewCellStyle that represents the style of the cell.

rowIndex
Int32 Int32 Int32

Índice de base cero de la fila de la celda.The zero-based row index of the cell.

constraintSize
Size Size Size

El tamaño máximo permitido de la celda.The cell's maximum allowable size.

Devoluciones

Size que representa el tamaño preferido, en píxeles, de la celda.A Size that represents the preferred size, in pixels, of the cell.

Comentarios

El GetPreferredSize método de la clase DataGridViewCell base siempre devuelve un Size con un ancho y un alto de-1.The GetPreferredSize method in the base class DataGridViewCell always returns a Size with a width and height of -1. Sin embargo, este método se invalida en las clases de celda derivadas para devolver los valores correctos.However, this method is overridden in the derived cell classes to return proper values.

Se aplica a

Consulte también: