DataGridViewCell.GetPreferredSize Metod

Definition

Beräknar önskad storlek, i bildpunkter, för cellen.

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

Parametrar

graphics
Graphics

Används Graphics för att rita cellen.

cellStyle
DataGridViewCellStyle

En DataGridViewCellStyle som representerar cellens formatmall.

rowIndex
Int32

Cellens nollbaserade radindex.

constraintSize
Size

Cellens maximala tillåtna storlek.

Returer

En Size som representerar önskad storlek, i bildpunkter, för cellen.

Kommentarer

Metoden GetPreferredSize i basklassen DataGridViewCell returnerar alltid en Size med bredd och höjd på -1. Den här metoden åsidosättas dock i de härledda cellklasserna för att returnera rätt värden.

Gäller för

Se även