Sdílet prostřednictvím


DataGridViewCell.GetPreferredSize Metoda

Definice

Vypočítá upřednostňovanou velikost buňky v pixelech.

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

Použitá Graphics k nakreslení buňky.

cellStyle
DataGridViewCellStyle

A DataGridViewCellStyle , který představuje styl buňky.

rowIndex
Int32

Index řádku založeného na nule buňky.

constraintSize
Size

Maximální povolená velikost buňky.

Návraty

Size

A Size , která představuje upřednostňovanou velikost buňky v pixelech.

Poznámky

Metoda GetPreferredSize v základní třídě DataGridViewCell vždy vrátí šířku Size a výšku -1. Tato metoda je však přepsána v odvozených tříd buněk vrátit správné hodnoty.

Platí pro

Viz také