F
fidtz
Sorry for asking here, but I don't know enough dotnet or Windows
programming yet to be very good at googling for answers. OTOH, this is
the first question I haven't be able to resolve myself, the
documentations is excellent.
This code looks to me like it should swap the bold highlight around,
but Regular never gets reapplied, leaving both labels in Bold.
Maybe there is a better way of doing this (aside from the obvious
refactor), but I can't see why this doesn't work and maybe the answer
will teach me of wider issues I should know about
void Label1Click(object sender, System.EventArgs e)
{
label1.Font = new Font(label1.Font, label1.Font.Style |
FontStyle.Bold);
label2.Font = new Font(label2.Font, label2.Font.Style |
FontStyle.Regular);
}
void Label2Click(object sender, System.EventArgs e)
{
label1.Font = new Font(label1.Font, label1.Font.Style |
FontStyle.Regular);
label2.Font = new Font(label2.Font, label2.Font.Style |
FontStyle.Bold);
}
label1 and label2 are two Windows Forms labels.
programming yet to be very good at googling for answers. OTOH, this is
the first question I haven't be able to resolve myself, the
documentations is excellent.
This code looks to me like it should swap the bold highlight around,
but Regular never gets reapplied, leaving both labels in Bold.
Maybe there is a better way of doing this (aside from the obvious
refactor), but I can't see why this doesn't work and maybe the answer
will teach me of wider issues I should know about
void Label1Click(object sender, System.EventArgs e)
{
label1.Font = new Font(label1.Font, label1.Font.Style |
FontStyle.Bold);
label2.Font = new Font(label2.Font, label2.Font.Style |
FontStyle.Regular);
}
void Label2Click(object sender, System.EventArgs e)
{
label1.Font = new Font(label1.Font, label1.Font.Style |
FontStyle.Regular);
label2.Font = new Font(label2.Font, label2.Font.Style |
FontStyle.Bold);
}
label1 and label2 are two Windows Forms labels.