DataGridViewCell.GetPreferredSize Metoda

Definicja

Oblicza preferowany rozmiar komórki w pikselach.

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

Obiekt Graphics używany do rysowania komórki.

cellStyle
DataGridViewCellStyle

Obiekt DataGridViewCellStyle reprezentujący styl komórki.

rowIndex
Int32

Indeks wiersza zerowego komórki.

constraintSize
Size

Maksymalny dozwolony rozmiar komórki.

Zwraca

Size

Obiekt Size reprezentujący preferowany rozmiar komórki w pikselach.

Uwagi

Metoda GetPreferredSize w klasie DataGridViewCell bazowej zawsze zwraca Size wartość o szerokości i wysokości -1. Jednak ta metoda jest zastępowana w klasach komórek pochodnych w celu zwrócenia odpowiednich wartości.

Dotyczy

Zobacz też