Machen Sie den text Fett wechseln nach Tastendruck
Ich habe ein Formular, in C#, dass einige Tasten. Ich möchte, dass wenn der button gedrückt wird, machen den text Fett.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Net;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//string str = @"C:\windows\system32\notepad.exe";
//string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\priority\bin.95\WINMENU.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
}
private void button2_Click(object sender, EventArgs e)
{
//string str = @"C:\windows\system32\notepad.exe";
//string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Program Files\UltraVNC\vncviewer.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button3_Click_1(object sender, EventArgs e)
{
//string str = @"C:\windows\system32\notepad.exe";
//string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Program Files\UltraVNC\vncviewer.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
}
private void button4_Click(object sender, EventArgs e)
{
//string str = @"C:\windows\system32\notepad.exe";
//string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Windows\system32\mstsc.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();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
}
}
was soll ich jetzt tun ?
- Wo ist der text? Button-text?
- winforms oder ASP.NET?
- Bitte gib uns mehr info über dein problem (welche Art von form, was Steuern, etc)
Du musst angemeldet sein, um einen Kommentar abzugeben.
Verwenden Sie das Click-Ereignis für die Schaltfläche, so etwas wie dieses:
@hyprsleepy - ich denke nicht, dass deine Antwort arbeiten können, da die Eigenschaft Button.Font.Fett ist nur Lesen Sie können also nur den Wert Lesen, um zu sehen, was es derzeit als set.
@asher - wo haben Sie diese Ereignisse:
verwenden eine ähnliche syntax wie diese:
Hier ist der code: