共用方式為


DataGridColumnStyle.ResetHeaderText 方法

定義

重設 HeaderText 為其預設值 null

public:
 void ResetHeaderText();
public void ResetHeaderText ();
member this.ResetHeaderText : unit -> unit
Public Sub ResetHeaderText ()

範例

下列程式碼範例示範此成員的使用。

private:
   void SetHeaderText( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Set the HeaderText property.
      myDataGridColumnStyle->HeaderText = "Emp ID";
      myDataGrid->Invalidate();
   }

   void ResetHeaderText( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Reset the HeaderText property to its default value.
      myDataGridColumnStyle->ResetHeaderText();
      myDataGrid->Invalidate();
   }
private void SetHeaderText(object sender, System.EventArgs e)
{
   // Set the HeaderText property.
   myDataGridColumnStyle.HeaderText = "Emp ID";
   myDataGrid.Invalidate();
} 
private void ResetHeaderText(object sender, System.EventArgs e)
{
   // Reset the HeaderText property to its default value.
   myDataGridColumnStyle.ResetHeaderText();
   myDataGrid.Invalidate();
   }
Private Sub SetHeaderText(ByVal sender As Object, ByVal e As EventArgs)
   ' Set the HeaderText property.
   myDataGridColumnStyle.HeaderText = "Emp ID"
   myDataGrid.Invalidate()
End Sub

Private Sub ResetHeaderText(ByVal sender As Object, ByVal e As EventArgs)
   ' Reset the HeaderText property to its default value.
   myDataGridColumnStyle.ResetHeaderText()
   myDataGrid.Invalidate()
End Sub

備註

如果您要建立 的設計 System.Windows.Forms.DataGrid 工具,或建立自己的控制項併入 System.Windows.Forms.DataGrid ,您通常會使用這個方法。

適用於