Access高手请进~
自己创建窗体,其中文本框名称为text0,四季按钮名称为Command1,
其全部代码如下:
Option Compare Database
Dim i As Integer '定义模块级变量
Private Sub Command1_Click()
'按钮单击事件
Dim seasons As Variant
Dim fc As Variant
Dim fn As Variant
seasons = Array("春", "夏", "秋", "冬")
fc = Array(RGB(0, 255, 0), RGB(255, 255, 0), RGB(0, 0, 255), RGB(255, 0, 0))
fn = Array("宋体", "仿宋体", "楷体", "黑体")
Me.Text0 = seasons(i)
Me.Text0.ForeColor = fc(i)
Me.Text0.FontName = fn(i)
i = i + 1
i = IIf(i > 3, 0, i)
End Sub
Private Sub Form_Load()
'窗体加载事件
Me.Text0 = "春"
Me.Text0.ForeColor = RGB(0, 255, 0)
Me.Text0.FontName = "宋体"
i = 1
End Sub
祝你成功!
另外,仿宋体和楷体没有体现出来,因为我的系统中没有这两个字体(我的是新宋体、宋体-PUA、楷体_GB2312...),只要你有就完全没问题,或者可以通过修改fn = Array("宋体", "仿宋体", "楷体", "黑体")变为其他字体!
2024-09-19 广告
广告 您可能关注的内容 |