LinkLabel no underline - Compact Framework

2019-07-04 10:24发布

问题:

I am developing a Windows CE app with Microsoft Compact Framework. I have to use a LinkLabel and it has to be white and no underline.

So in the designer, I modified font color by white and unchecked "underline" in the font dialog.

However, when I run the application, the font is still blue and underlined.

Is there a way to remove the underline of a LinkLabel and change its color?

回答1:

It wont be visible in the designer at Design-Time but will be correct in Runtime.

Otherwise do it in Code (which should be the same as the designers code):

Font f = LinkLabel1.Font; 
LinkLabel1.Font = New Font(f, f.Style && !FontStyle.Underline)


回答2:

Me.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;