DataGridViewRow.Height 屬性

定義

取得或設定資料列的目前高度。

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

屬性值

Int32

資料列的高度 (單位為像素)。 預設值是預設字型的高度加 9 個像素。

例外狀況

在設定這個屬性時,資料列位於 DataGridView 控制項中而且是一個共用資料列。

範例

下列程式碼範例會 Height 使用 屬性來設定第一列的高度。 此程式碼範例是如何:操作 DataGridView 控制項中Windows Forms資料列中提供之較大程式碼範例的一部分。

// 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 屬性。

適用於

另請參閱