VB里如何通过列表(ListBox)设置字体的粗体、斜体、粗斜体?
发布网友
发布时间:2022-04-26 22:52
我来回答
共1个回答
热心网友
时间:2022-06-19 11:50
添加一个text 添加一个list 编写以下代码:Private Sub Form_Load()List1.AddItem ("粗体")
List1.AddItem ("倾斜")
List1.AddItem ("下划线")
List1.AddItem ("删除线")
End SubPrivate Sub List1_Click()
Select Case List1.Text
Case "粗体"
Text1.FontBold = True
Text1.FontItalic = False
Text1.FontUnderline = False
Text1.FontStrikethru = False
Case "倾斜"
Text1.FontItalic = True
Text1.FontBold = False
Text1.FontUnderline = False
Text1.FontStrikethru = False
Case "下划线"
Text1.FontUnderline = True
Text1.FontBold = False
Text1.FontItalic = False
Text1.FontStrikethru = False
Case "删除线"
Text1.FontStrikethru = True
Text1.FontBold = False
Text1.FontItalic = False
Text1.FontUnderline = False
End SelectEnd Sub