DataGridViewRow.Height 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定該列目前的高度。
public:
property int Height { int get(); void set(int value); };
public int Height { get; set; }
member this.Height : int with get, set
Public Property Height As Integer
屬性值
列的高度(以像素計)。 預設是預設字型的高度加上 9 像素。
例外狀況
設定此屬性時,該列屬於 DataGridView 控制項且為共享列。
範例
以下程式碼範例使用該 Height 屬性來設定第一列的高度。 此程式碼範例是 Windows Forms DataGridView 控制項中「如何操作資料列」中提供的完整程式碼範例的一部分。
// Set height.
void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
DataGridViewRow^ row = dataGridView->Rows[ 0 ];
row->Height = 15;
}
// Set height.
private void Button5_Click(object sender, System.EventArgs e)
{
DataGridViewRow row = dataGridView.Rows[0];
row.Height = 15;
}
' Set height.
Private Sub Button5_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Button5.Click
Dim row As DataGridViewRow = dataGridView.Rows(0)
row.Height = 15
End Sub
備註
要設定一列的最小高度,請使用 屬性。MinimumHeight