DataGridView.TopLeftHeaderCell 屬性

定義

取得或設定位於 DataGridView 控制項左上角的標頭儲存格。Gets or sets the header cell located in the upper left corner of the DataGridView control.

public:
 property System::Windows::Forms::DataGridViewHeaderCell ^ TopLeftHeaderCell { System::Windows::Forms::DataGridViewHeaderCell ^ get(); void set(System::Windows::Forms::DataGridViewHeaderCell ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.DataGridViewHeaderCell TopLeftHeaderCell { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.TopLeftHeaderCell : System.Windows.Forms.DataGridViewHeaderCell with get, set
Public Property TopLeftHeaderCell As DataGridViewHeaderCell

屬性值

DataGridViewHeaderCell

位於 DataGridViewHeaderCell 左上角的 DataGridViewThe DataGridViewHeaderCell located at the upper left corner of the DataGridView.

屬性

範例

下列程式碼範例會使用這個屬性,在控制項的左上角顯示值 DataGridViewThe following code example uses this property to display a value in the upper-left corner of a DataGridView control. 此值會在主要/詳細案例中標示子資料工作表。This value labels a child table in a master/detail scenario. 此範例是類別總覽主題中可用之較大範例的一部分 DataGridViewComboBoxColumnThis example is part of a larger example available in the DataGridViewComboBoxColumn class overview topic.

private:
    void SetUpDataGridView2()
    {
        DataGridView2->Dock = DockStyle::Bottom;
        DataGridView2->TopLeftHeaderCell->Value = "Sales Details";
        DataGridView2->RowHeadersWidthSizeMode = 
            DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders;
    }
private void SetUpDataGridView2()
{
    DataGridView2.Dock = DockStyle.Bottom;
    DataGridView2.TopLeftHeaderCell.Value = "Sales Details";
    DataGridView2.RowHeadersWidthSizeMode = 
        DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
}
Private Sub SetUpDataGridView2()
    DataGridView2.Dock = DockStyle.Bottom
    DataGridView2.TopLeftHeaderCell.Value = "Sales Details"
    DataGridView2.RowHeadersWidthSizeMode = _
    DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders
End Sub

備註

設定此屬性可讓您設定資料格的值、建立快捷方式功能表與其的關聯,或執行您可以在上執行的任何其他作業 DataGridViewHeaderCellSetting this property allows you to set a value for the cell, associate a shortcut menu with it, or perform any other operations you can perform on a DataGridViewHeaderCell.

在設計成與由右至左語言搭配使用的應用程式中,此屬性所代表的儲存格通常位於右上角。In applications designed for use with right-to-left languages, the cell represented by this property is typically in the upper-right corner.

適用於