編輯

共用方式為


DataGridViewColumnHeaderCell.GetPreferredSize Method

Definition

Calculates the preferred size, in pixels, of the cell.

protected:
 override System::Drawing::Size GetPreferredSize(System::Drawing::Graphics ^ graphics, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, int rowIndex, System::Drawing::Size constraintSize);
protected override System.Drawing.Size GetPreferredSize (System.Drawing.Graphics graphics, System.Windows.Forms.DataGridViewCellStyle cellStyle, int rowIndex, System.Drawing.Size constraintSize);
override this.GetPreferredSize : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int * System.Drawing.Size -> System.Drawing.Size
Protected Overrides Function GetPreferredSize (graphics As Graphics, cellStyle As DataGridViewCellStyle, rowIndex As Integer, constraintSize As Size) As Size

Parameters

graphics
Graphics

The Graphics used to draw the cell.

cellStyle
DataGridViewCellStyle

A DataGridViewCellStyle that represents the style of the cell.

rowIndex
Int32

The zero-based row index of the cell.

constraintSize
Size

The cell's maximum allowable size.

Returns

A Size that represents the preferred size, in pixels, of the cell.

Exceptions

rowIndex is not -1.

Applies to

See also