Label1.Attributes.Add("onmouseover", "this.style.textDecoration='underline'"); //显示下划线
西吉网站建设公司创新互联建站,西吉网站设计制作,有大型网站制作公司丰富经验。已为西吉近1000家提供企业网站建设服务。企业网站搭建\外贸网站建设要多少钱,请找那个售后服务好的西吉做网站的公司定做!
Label1.Attributes.Add("onmouseout", "this.style.textDecoration=''"); //隐藏下划线
将Label1 改成相应的 label 控件名称。
'鼠标经过时,显示下划线
Private Sub Label1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter
Dim LabelFont As Font = New Font(Label1.Font.Name, Label1.Font.Size, FontStyle.Underline)
Label1.Font.Dispose()
Label1.Font = LabelFont
End Sub
'鼠标离开时,去除下划线
Private Sub Label1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseLeave
Dim LabelFont As Font = New Font(Label1.Font.Name, Label1.Font.Size, FontStyle.Regular)
Label1.Font.Dispose()
Label1.Font = LabelFont
End Sub
'控件一个文本框text1,五个按钮command1至command5
Private Sub Command1_Click() '增大字体
Text1.FontSize = Text1.FontSize + 1
End Sub
Private Sub Command2_Click() '缩小字体
If Text1.FontSize 2 Then Text1.FontSize = Text1.FontSize - 1
End Sub
Private Sub Command3_Click() '变换下划线
Text1.FontUnderline = Not Text1.FontUnderline
End Sub
Private Sub Command4_Click() '变换粗体
Text1.FontBold = Not Text1.FontBold
End Sub
Private Sub Command5_Click() '变换斜体
Text1.FontItalic = Not Text1.FontItalic
End Sub