简体   繁体   English

LinkLabel 无下划线 - 紧凑框架

[英]LinkLabel no underline - Compact Framework

I am developing a Windows CE app with Microsoft Compact Framework.我正在使用 Microsoft Compact Framework 开发 Windows CE 应用程序。 I have to use a LinkLabel and it has to be white and no underline.我必须使用 LinkLabel 并且它必须是白色的并且没有下划线。

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?有没有办法删除 LinkLabel 的下划线并更改其颜色?

You can use LinkBehavior :您可以使用LinkBehavior

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

在此处输入图片说明

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM