hi guys! how can i set the Underline Property of my Label programmatically?
Printable View
hi guys! how can i set the Underline Property of my Label programmatically?
:)VB Code:
this.Label1.Font = new Font(new FontFamily("Arial"), 12F, FontStyle.Underline);
If you don't want to change anything other than the underlining then you'd use a different overload of the Font constructor:Code:// Apply underlining (bitwise OR).
this.label1.Font = new Font(this.label1.Font,
this.label1.Font.Style | FontStyle.Underline);
// Remove underlining (bitwise AND, bitwsie complement).
this.label1.Font = new Font(this.label1.Font,
this.label1.Font.Style & ~FontStyle.Underline);
// Toggle underlining (bitwise exclusive OR).
this.label1.Font = new Font(this.label1.Font,
this.label1.Font.Style ^ FontStyle.Underline);
Thanks a bunch Rob!
Thanks for that JM..