第2个回答 2009-03-20
不知道定时器有什么用,没写,注意Command2、Command3、Command4我用了两种效果:
第一种是点击按钮粗体时为粗体,继续点还是粗体,默认;
第二种是点击按钮粗体时为粗体,继续点取消粗体,循环。
需要第一种效果时代码无需修改,或者把代码中绿色字体的注释去掉(即单引号后面的文字去掉);
需要第二种效果时,在每个按钮的命令里第一行首字母前加上单引号,第二行的单引号去掉即可(虽然解释得太详细,其实稍微看一下就知道怎么做了)
Private Sub Command1_Click()
Label1.FontBold = False
Label1.FontItalic = False
Label1.FontUnderline = False
End Sub
Private Sub Command2_Click()
Label1.FontBold = True
'Label1.FontBold = Not Label1.FontBold
End Sub
Private Sub Command3_Click()
Label1.FontItalic = True
'Label1.FontItalic = Not Label1.FontItalic
End Sub
Private Sub Command4_Click()
Label1.FontUnderline = True
'Label1.FontUnderline = Not Label1.FontUnderline
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Form_Load()
Label1.Caption = "水光潋滟晴方好,山色空蒙雨亦奇" & vbNewLine & "欲把西湖比西子,淡妆浓沫总相宜"
Command1.Caption = "标准"
Command2.Caption = "粗体"
Command3.Caption = "斜体"
Command4.Caption = "下划线"
Command5.Caption = "退出"
End Sub