如何在VB.Net中自定义linklabel的字体? [英] How to customize the font for linklabel in VB.Net?

查看:92
本文介绍了如何在VB.Net中自定义linklabel的字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的表单包含许多带有arial字体的控件。我在它的运行时创建了一个linklabel。默认情况下,我认为它设置为Microsoft Sans Serif。我试图将链接标签的字体自定义为arial,但它没有改变。

任何帮助??





注意:我无法上传我的表单。抱歉。

Hi everyone,
My form contains many controls with arial font. I've created a linklabel on it runtime. By default it sets to "Microsoft Sans Serif", i think. I've tried to customize the font for link label to arial but it's not changed.
Any help??


Note : I cant able to upload my form snap sorry.

推荐答案

将控件添加到表单后,它会从表单继承字体(或你使用的容器)



所以我猜你的Forms字体没有设置,所以它使用Microsoft Sans Serif; 8,25pt作为默认值。

并继承到你的LinkLabel。



你可以设置你的字体

After you add your Control to your Form it inherits the Font from your Form (or the Container you use)

So i guess your Forms Font is not set, so it uses "Microsoft Sans Serif; 8,25pt" as default value.
and that gets inherited to your LinkLabel.

You can set your Font with
yourLinkLabel.Font = New Font("Arial", 15)



将它添加到容器后!


AFTER it was added to a Container!


我将检查事件处理程序。我的代码是。



I'll check with event handler. And my code is.

Friend WithEvents events_label As System.Windows.Forms.LinkLabel 
Private Sub treeUcompany_AfterSelect(ByVal sender As Object, ByVal e As TreeViewEventArgs) Handles treeUcompany.AfterSelect 
Me.events_label = New Windows.Forms.LinkLabel 
With events_label 
.Text = "Events: " & event_link 
.Location = New Point(31, 55) 
.LinkArea = New LinkArea(18, Len(events_label.Text)) 
.AutoSize = True 
.Font = New Font("Arial", 10) 
.Visible = True 
End With 
Me.pnlUCompanyDetails.Controls.Add(events_label)
End sub


这篇关于如何在VB.Net中自定义linklabel的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆