VB写记事本

来源:百度知道 编辑:UC知道 时间:2024/06/20 13:10:00
求一段代码运行后能在text1改字体字号和颜色

dim fntNew as new font
dim fntColor as color
if dlgFont.ShowDialog=OK then
fntNew=dlgFont.Font
endif
if dlgColor.ShowDialog=OK then
fntColor=dlgColor.Color
endif
if fntNew isnot nothing and fntColor isnot Nothing then
text1.font=fntNew
txt1.forecolor=fntColor
endif

这是 2008 的代码,事先请添加 ColorDialog 和 FontDialog,命名为 dlgFont、dlgColor