代码:Public Sub ControlsFont(ByVal frmMain As Form)
On Error GoTo MeErr
Dim ctl As Control
Dim ctlName As String
Dim strFontName As String
Dim intFontSize As Double
'--------------------------------------------------------------------------------------------------
strFontName = "宋体"
intFontSize = 10
frmMain.Font.Name = strFontName----这句报错
frmMain.Font.Size = intFontSize----这句报错
frmMain.Font.Bold = False
求各位大侠帮忙 谢谢
On Error GoTo MeErr
Dim ctl As Control
Dim ctlName As String
Dim strFontName As String
Dim intFontSize As Double
'--------------------------------------------------------------------------------------------------
strFontName = "宋体"
intFontSize = 10
frmMain.Font.Name = strFontName----这句报错
frmMain.Font.Size = intFontSize----这句报错
frmMain.Font.Bold = False
求各位大侠帮忙 谢谢
解决方案 »
- 对RichEdit进行编程时遇到了问题
- VB判断总是不行,一个死循环的问题
- ListView中按下[Alt]+[Enter]后总会有一声Beep的声音,请问高手们怎么取掉它.急!!谢谢大家!
- 对象关闭时,不允许操作??
- 怎样打印DataGrid中的内容?
- 请教:我想在我的软件上添加一个检测打印机是否安装的程序,应该怎样写呢?
- 有偿求助! 怎样去背景叠加图片?
- 如何在Form_load事件中通过API函数调用自动获得当前窗体的句柄,而不是采用Me.Hwnd。
- 菜鸟有一问题请教
- 我的程序中用了一个日历控件,打包时系统提示我相关的mscal.ocx文件过期,请问怎么解决?
- vb6怎么给msgbox消息框加上皮肤
- 急!!在线等,实时错误:380 无效属性值
Option Explicit
Private Sub ControlsFont(ByRef objP As Control)
Dim ctl As Control
Dim ctlName As String
Dim strFontName As String
Dim intFontSize As Double
On Error Resume Next '忽略一些不支持字体的控件设置字体属性所产生的错误
strFontName = "宋体"
intFontSize = 14
objP.Font.Size = intFontSize
objP.Font.Name = strFontName
objP.Font.Bold = True
End SubPrivate Sub Form_Load()
ControlsFont Text1
Text1.Text = "中华人民共和国"End Sub
debug.print strFontName
debug.print intFontSize 调试下这2变量的值是否正常?
估计是变量赋值不合法。
frmMain.Font.Size = intFontSize----这句报错这两名写法没有问题,注掉出错处理,然后检查其它错误。
http://topic.csdn.net/u/20110221/19/f1b4b0c0-eeaa-4581-ba03-02b9685adc2b.html
Dim ctl As Control
For Each ctl In frmMain.Controls
ctl.Font.name=
ctl.Font.size=
Next