跪求!!!用【字体】和【颜色】对话框设置文本框文字
发布网友
发布时间:2022-05-03 05:01
我来回答
共2个回答
热心网友
时间:2023-10-10 06:28
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
热心网友
时间:2023-10-10 06:28
字体名、字号、粗体、斜体、下划线、删除线-----在"FONT"属性项里面设置.
颜色-----在"forecolor"属性项里面设置
文本框的背景色-----在"backcolor"属性项里面设置