DataGrid.ResetHeaderFont 方法

定义

HeaderFont 属性重置为其默认值。

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

示例

下面的代码示例演示了此成员的使用。

private:
   // Set the header font to Arial with size 20.
   void button6_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      myDataGrid->HeaderFont = gcnew System::Drawing::Font( "Arial",20 );
   }

   // Reset the header font.
   void button5_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      myDataGrid->ResetHeaderFont();
   }
// Set the header font to Arial with size 20.
private void button6_Click(object sender, EventArgs e)
{
   myDataGrid.HeaderFont = new Font("Arial", 20);
}
// Reset the header font.
private void button5_Click(object sender, EventArgs e)
{
   myDataGrid.ResetHeaderFont();
}
' Set the header font to Arial with size 20.
Private Sub button6_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button6.Click
    myDataGrid.HeaderFont = New Font("Arial", 20)
End Sub

' Reset the header font.
Private Sub button5_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button5.Click
    myDataGrid.ResetHeaderFont()
End Sub

注解

如果要为 System.Windows.Forms.DataGrid 合并 System.Windows.Forms.DataGrid的控件创建设计器或创建自己的控件,则通常使用此方法。 可以使用 ShouldSerializeHeaderFont 该方法来确定属性值是否已从默认值更改。

适用于