标题:回答:如何让文本框的字变色
取消只看楼主
那边有朵蘑菇云
Rank: 1
来 自:很……那啥的一个地方
等 级:新手上路
威 望:1
帖 子:390
专家分:0
注 册:2007-9-3
 问题点数:0 回复次数:0 
回答:如何让文本框的字变色

自己做了一个很简单 用TIMER控件来控制文本的颜色

附件上传不了 我直接贴代码得了

Option Explicit

Private Sub Command1_Click()
Timer1.Enabled = True
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End Sub

Private Sub Command3_Click()
Text1.ForeColor = vbBlack
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = False
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 500
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = False
End Sub

Private Sub Timer1_Timer()
Static i As Integer
Dim j As Integer
i = i + 1
j = i Mod 5
Select Case j
 Case 0
      Text1.ForeColor = RGB(145, 85, 147)
 Case 1
      Text1.ForeColor = vbRed
 Case 2
      Text1.ForeColor = vbBlue
 Case 3
      Text1.ForeColor = vbYellow
 Case 4
      Text1.ForeColor = RGB(36, 241, 75)
End Select
End Sub
红色部分为控制颜色代码
搜索更多相关主题的帖子: 文本 变色 
2007-12-05 09:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-190480-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.459638 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved