DataGridViewCell.GetPreferredSize Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
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
- 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.