簡體   English   中英

如何使按鈕文本加粗?

[英]How to make button text bold?

我想讓動態添加的按鈕上的文本加粗。 我該怎么做?

這是我的代碼:

var b = new Button()
{
    Location = new Point(x * 30, y * 30),
    Width = 30,
    Height = 30,
    Tag = new Point(y, x), // game location x, y
    BackColor = Color.SkyBlue,
};

Windows 窗體:

var b = new Button()
{
    Location = new Point(x * 30, y * 30),
    //...
};
b.Font = new Font(b.Font.Name, b.Font.Size, FontStyle.Bold);

WPF:

var b = new Button()
{
    Location = new Point(x * 30, y * 30),
    //...
    FontWeight = FontWeights.Bold
};

ASP.NET

var b = new Button()
{
    Location = new Point(x * 30, y * 30),
    //...
};
b.Font.Bold = true;

試試這段代碼的最后一行:

var b = new Button()
{
    Location = new Point(x * 30, y * 30),
    Width = 30,
    Height = 30,
    Tag = new Point(y, x), // game location x, y
    BackColor = Color.SkyBlue,
    Font = new Font("Tahoma", 8.25F, FontStyle.Bold)
};

Visual Basic 中的通用格式是:

btn.Font = New Font("Font Name", Font Size, FontStyle.Bold)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM