跪求!!!用【字体】和【颜色】对话框设置文本框文字
利用通用对话框设置文本框的字体(包括字体名、字号、粗体、斜体、下划线、删除线和颜色),并且设置文本框的背景色。这该怎么做呀??VB请写出完整的原代码!~...
利用通用对话框设置文本框的字体(包括字体名、字号、粗体、斜体、下划线、删除线和颜色),并且设置文本框的背景色。
这该怎么做呀??VB
请写出完整的原代码!~ 展开
这该怎么做呀??VB
请写出完整的原代码!~ 展开
2个回答
展开全部
Private Sub Command1_Click() '设置字体及其颜色
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowFont
If CommonDialog1.FontName <> "" Then Text1.FontName = CommonDialog1.FontName
Text1.FontSize = CommonDialog1.FontSize
Text1.FontBold = CommonDialog1.FontBold
Text1.FontItalic = CommonDialog1.FontItalic
Text1.FontUnderline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.ForeColor = CommonDialog1.Color
ErrHandler:
Exit Sub
End Sub
Private Sub Command2_Click() '设置背景色
CommonDialog1.ShowColor
Text1.BackColor = CommonDialog1.Color
End Sub
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowFont
If CommonDialog1.FontName <> "" Then Text1.FontName = CommonDialog1.FontName
Text1.FontSize = CommonDialog1.FontSize
Text1.FontBold = CommonDialog1.FontBold
Text1.FontItalic = CommonDialog1.FontItalic
Text1.FontUnderline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.ForeColor = CommonDialog1.Color
ErrHandler:
Exit Sub
End Sub
Private Sub Command2_Click() '设置背景色
CommonDialog1.ShowColor
Text1.BackColor = CommonDialog1.Color
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询