Font.Style Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets style information for this Font.
public:
property System::Drawing::FontStyle Style { System::Drawing::FontStyle get(); };
[System.ComponentModel.Browsable(false)]
public System.Drawing.FontStyle Style { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Style : System.Drawing.FontStyle
Public ReadOnly Property Style As FontStyle
Property Value
A FontStyle enumeration that contains style information for this Font.
- Attributes
Examples
The following code example demonstrates how to set the Font property of a button to a new bold font using the FontStyle enumeration. This example is designed to be used with Windows Forms. Create a form containing a button named Button1
and paste the following code into it. Associate the Button1_Click
method with the button's Click event.
private:
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
Button1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,12.0F,FontStyle::Bold );
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
if (Button1.Font.Style != FontStyle.Bold)
Button1.Font = new Font(FontFamily.GenericSansSerif,
12.0F, FontStyle.Bold);
}
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Not Button1.Font.Style = FontStyle.Bold Then
Button1.Font = New Font(FontFamily.GenericSansSerif, _
12.0F, FontStyle.Bold)
End If
End Sub
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應