DataGridViewCell.GetPreferredSize メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCell.GetPreferredSize メソッドの意味・解説 

DataGridViewCell.GetPreferredSize メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

セルの推奨されるサイズをピクセル単位で計算します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Protected Overridable Function
 GetPreferredSize ( _
    graphics As Graphics, _
    cellStyle As DataGridViewCellStyle, _
    rowIndex As Integer, _
    constraintSize As Size _
) As Size
Dim graphics As Graphics
Dim cellStyle As DataGridViewCellStyle
Dim rowIndex As Integer
Dim constraintSize As Size
Dim returnValue As Size

returnValue = Me.GetPreferredSize(graphics, cellStyle, rowIndex,
 constraintSize)
protected virtual Size GetPreferredSize (
    Graphics graphics,
    DataGridViewCellStyle cellStyle,
    int rowIndex,
    Size constraintSize
)
protected:
virtual Size GetPreferredSize (
    Graphics^ graphics, 
    DataGridViewCellStyle^ cellStyle, 
    int rowIndex, 
    Size constraintSize
)
protected Size GetPreferredSize (
    Graphics graphics, 
    DataGridViewCellStyle cellStyle, 
    int rowIndex, 
    Size constraintSize
)
protected function GetPreferredSize (
    graphics : Graphics, 
    cellStyle : DataGridViewCellStyle, 
    rowIndex : int, 
    constraintSize : Size
) : Size

パラメータ

graphics

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

cellStyle

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

rowIndex

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

constraintSize

セルの最大許容サイズ。

戻り値
セルの推奨されるサイズをピクセル単位で表す Size。

解説解説

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

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCell クラス
DataGridViewCell メンバ
System.Windows.Forms 名前空間
DataGridView クラス



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DataGridViewCell.GetPreferredSize メソッド」の関連用語

DataGridViewCell.GetPreferredSize メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewCell.GetPreferredSize メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS