C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Note: Obviously, this is not what you will want it to read in your finished application.
Then: Select a color. It would be best to use a system color. The user could have adjusted the theme colors in some way.
Note: In the screenshot, the ForeColor was set to Red. This could help indicate a warning.
Tip: You can change many of the individual options for the Font on the label. You can, for example, set that the font be bold here.
Tip: To add the Click event handler, please open Properties and click on the lightning bolt. Then, double-click on the Click item.
C# program that uses Click event handler on Label
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
// Change the text of the label to a random file name.
// ... Occurs when you click on the label.
label1.Text = System.IO.Path.GetRandomFileName();
}
}
}
And: Through the event model, you can mutate the Text property, the coloring, and other properties.