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

Definicja

Oblicza preferowany rozmiar komórki w pikselach.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
Protected Overridable Function GetPreferredSize (graphics As Graphics, cellStyle As DataGridViewCellStyle, rowIndex As Integer, constraintSize As Size) As Size

Parametry

graphics
Graphics

Graphics używany do rysowania komórki.The Graphics used to draw the cell.

cellStyle
DataGridViewCellStyle

DataGridViewCellStyle, która reprezentuje styl komórki.A DataGridViewCellStyle that represents the style of the cell.

rowIndex
Int32

Indeks wiersza (liczony od zera) komórki.The zero-based row index of the cell.

constraintSize
Size

Maksymalny dozwolony rozmiar komórki.The cell's maximum allowable size.

Zwraca

Size, który reprezentuje preferowany rozmiar komórki w pikselach.A Size that represents the preferred size, in pixels, of the cell.

Uwagi

Metoda GetPreferredSize w klasie bazowej DataGridViewCell zawsze zwraca Size z szerokością i wysokością-1.The GetPreferredSize method in the base class DataGridViewCell always returns a Size with a width and height of -1. Jednak ta metoda zostanie zastąpiona w klasach komórek pochodnych w celu zwrócenia odpowiednich wartości.However, this method is overridden in the derived cell classes to return proper values.

Dotyczy

Zobacz też