C# 4.0 按下按钮后使文本变为粗体
我有一个C语言的表单,它有一些按钮。我希望当按下按钮时,将文本加粗C# 4.0 按下按钮后使文本变为粗体,c#-4.0,C# 4.0,我有一个C语言的表单,它有一些按钮。我希望当按下按钮时,将文本加粗 我现在该怎么办?使用按钮的单击事件,类似以下内容: private void button_Click(object sender, EventArgs e) { Button b = ((Button)sender); b.Font = new Font(b.Font, FontStyle.Bold); } 对按钮使用Click事件,如下所示: private void bu
我现在该怎么办?使用按钮的单击事件,类似以下内容:
private void button_Click(object sender, EventArgs e)
{
Button b = ((Button)sender);
b.Font = new Font(b.Font, FontStyle.Bold);
}
对按钮使用Click事件,如下所示:
private void button_Click(object sender, EventArgs e)
{
Button b = ((Button)sender);
b.Font = new Font(b.Font, FontStyle.Bold);
}
@hyprsleepy-我认为您的答案不起作用,因为property Button.Font.Bold是只读的,因此您只能读取该值以查看它当前的设置 @asher-您在哪里举办这些活动:
private void button5_Click(object sender, EventArgs e)
{
// string str = @"C:\windows\system32\notepad.exe";
// string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Program Files\Microsoft Office\Office14\winword.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
}
使用与此类似的语法:
private void button5_Click(object sender, EventArgs e)
{
// string str = @"C:\windows\system32\notepad.exe";
// string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Program Files\Microsoft Office\Office14\winword.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
Button b = ((Button)sender);
b.Font = new Font(b.Font, FontStyle.Bold);
}
@hyprsleepy-我认为您的答案不起作用,因为property Button.Font.Bold是只读的,因此您只能读取该值以查看它当前的设置 @asher-您在哪里举办这些活动:
private void button5_Click(object sender, EventArgs e)
{
// string str = @"C:\windows\system32\notepad.exe";
// string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Program Files\Microsoft Office\Office14\winword.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
}
使用与此类似的语法:
private void button5_Click(object sender, EventArgs e)
{
// string str = @"C:\windows\system32\notepad.exe";
// string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Program Files\Microsoft Office\Office14\winword.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
Button b = ((Button)sender);
b.Font = new Font(b.Font, FontStyle.Bold);
}
代码如下:
private void button1_Click(object sender, EventArgs e)
{
button1.Font = new Font(this.Font, FontStyle.Bold);
}
代码如下:
private void button1_Click(object sender, EventArgs e)
{
button1.Font = new Font(this.Font, FontStyle.Bold);
}
文本在哪里?按钮文本?请给我们更多关于您的问题的信息(什么样的表单,什么控件等)文本在哪里?按钮文本?请给我们更多关于你的问题的信息(什么样的表单,什么控件,等等)是的,我以为是-你是对的,安迪,我没有仔细检查。我通常只是用CSS来做造型,并尽可能地把它从代码中去掉。是的,我想是的-你说得对,安迪,我没有仔细检查。我通常只使用CSS进行样式化,并尽可能将其从代码中删除。