DataGridViewCell.GetPreferredSize 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
計算儲存格的慣用大小 (以像素為單位)。
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
參數
- cellStyle
- DataGridViewCellStyle
代表儲存格樣式的 DataGridViewCellStyle。
- rowIndex
- Int32
儲存格之以零為起始的資料列索引。
- constraintSize
- Size
儲存格可允許大小的最大值。
傳回
Size,表示儲存格的慣用大小 (以像素為單位)。
備註
基 GetPreferredSize 類 DataGridViewCell 中的 方法一律會 Size 傳回寬度和高度為 -1 的 。 不過,這個方法會在衍生的資料格類別中覆寫,以傳回適當的值。