如何在紧凑框架中删除 link 标签的下划线 (windows ce)
how to remove underline from link label in compact framework (windows ce)
如何在 compact framework 中删除 link 标签的下划线?由于标签和文本框没有点击事件,我必须使用 linklabel 作为其支持的点击事件。
已尝试 this 解决方案,但无法正常工作,显示错误:Operator '!'不能应用于 'System.Drawing.FontStyle'
类型的操作数
知道如何删除下划线和更改字体颜色吗?
一种简单的方法是从 LinkLabel
继承用户控件并覆盖 OnPaint
。其中使用 GDI+ 呈现 LinkLabel 的内容。您仍将拥有 LinkLabel 的所有其他功能,只是文本不会有下划线,如您所愿。
以下几行内容:
class CustomLinkLabel : LinkLabel
{
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
//MyBase.OnPaint(e)
using (SolidBrush B = new SolidBrush(this.ForeColor))
{
e.Graphics.DrawString(this.Text, this.Font, B, e.ClipRectangle.X, e.ClipRectangle.Y);
}
}
}
如何在 compact framework 中删除 link 标签的下划线?由于标签和文本框没有点击事件,我必须使用 linklabel 作为其支持的点击事件。
已尝试 this 解决方案,但无法正常工作,显示错误:Operator '!'不能应用于 'System.Drawing.FontStyle'
类型的操作数知道如何删除下划线和更改字体颜色吗?
一种简单的方法是从 LinkLabel
继承用户控件并覆盖 OnPaint
。其中使用 GDI+ 呈现 LinkLabel 的内容。您仍将拥有 LinkLabel 的所有其他功能,只是文本不会有下划线,如您所愿。
以下几行内容:
class CustomLinkLabel : LinkLabel
{
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
//MyBase.OnPaint(e)
using (SolidBrush B = new SolidBrush(this.ForeColor))
{
e.Graphics.DrawString(this.Text, this.Font, B, e.ClipRectangle.X, e.ClipRectangle.Y);
}
}
}