Label1.Attributes.Add("onmouseover", "this.style.textDecoration='underline'"); //顯示下劃線
西吉網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,西吉網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為西吉近1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的西吉做網(wǎng)站的公司定做!
Label1.Attributes.Add("onmouseout", "this.style.textDecoration=''"); //隱藏下劃線
將Label1 改成相應(yīng)的 label 控件名稱。
'鼠標(biāo)經(jīng)過時(shí),顯示下劃線
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
'鼠標(biāo)離開時(shí),去除下劃線
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
'控件一個(gè)文本框text1,五個(gè)按鈕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