vb中如何改变控制按钮上的字体颜色

如题所述

Sub s()
    '用颜色常数:
    CommandButton1.ForeColor = vbRed '红
    CommandButton1.ForeColor = vbBlue '蓝
    CommandButton1.ForeColor = vbWhite '白
    
    '用QBColor函数:
    CommandButton1.ForeColor = QBColor(n) 'n的值是0到15
    
    '用RGB函数:
    CommandButton1.ForeColor = RGB(r, g, b) 'r、g、b的值分别是0到255
    
    '直接用颜色值:
    CommandButton1.ForeColor = &HFF& '红
    CommandButton1.ForeColor = &HFF00& '绿
    CommandButton1.ForeColor = &HFF0000 '蓝
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-12-25
CommandButton控件没有ForeColor,因此无法修改字体颜色,但是你可以编辑一个图片,将图片显示在CommandButton控件上:
Command1.Style = 1
Command1.Picture = "c:/a.gif"
第2个回答  2009-12-25
貌似不可以,但可以设置成图形按钮,在里面加载一幅有字的图片。
第3个回答  2009-12-25
command1.forecolor=vbred'(红色)
第4个回答  2009-12-25
按钮的forecolor属性 。如:
command1.forecolor = vbblue本回答被网友采纳
相似回答