Language

DataGridViewCell.GetPreferredSize メソッド

定義

セルの優先サイズをピクセル単位で計算します。

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

パラメーター

graphics
Graphics

セルの描画に使用する Graphics 。

cellStyle
DataGridViewCellStyle

セルのスタイルを表す DataGridViewCellStyle 。

rowIndex
Int32

セルの 0 から始まる行インデックス。

constraintSize
Size

セルの最大許容サイズ。

返品

セルの優先サイズをピクセル単位で表す Size 。

注釈

基底クラスGetPreferredSizeのDataGridViewCell メソッドは、常に幅と高さが -1 のSizeを返します。 ただし、このメソッドは、適切な値を返すために、派生セル クラスでオーバーライドされます。

適用対象

こちらもご覧ください