标题:[求助]我靠!!!!!难弄啊!!!
只看楼主
hl0071
Rank: 1
等 级:新手上路
帖 子:125
专家分:0
注 册:2005-11-11
 问题点数:0 回复次数:4 
[求助]我靠!!!!!难弄啊!!!

郁闷啊,请问大侠们怎么实现用一个LABEL控件和一个时钟控件完成LABEL的背景颜色慢慢由红变深红达到一定程度再由慢慢由绿变成深绿,然后再慢慢由蓝变成深蓝,然后再由红变深红.....................................如此循环下去,靠,我弄了三天都没弄出来,真是没脾气,在这请教各位大侠了.在下感激啊,
下面是我编的一些代码但是不行,不知道哪里错了.



Dim a As Long
Dim b As Long

Private Sub Command1_Click()
Timer1.Enabled = True
a = Timer
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Label1.BackColor = RGB(b, 100, 100) Or RGB(100, 100, b) Or RGB(100, b, 100)
End Sub

Private Sub Timer1_Timer()
Dim b As Long
b = (Timer - a) * 100
Text1.Text = b

b = (Timer - a) * 100
' Label1.BackColor = RGB(b, 100, 100)
If Label1.BackColor = RGB(1000, 100, 100) Then

Command1_Click
b = (Timer - a) * 100
Label1.BackColor = RGB(100, 100, 100)
End If
If Label1.BackColor = RGB(100, 1000, 100) And b > 1000 Then
Command1_Click
b = (Timer - a) * 100
Label1.BackColor = RGB(100, 100, b)
End If
If Label1.BackColor = RGB(100, 100, 1000) And b > 1000 Then
Command1_Click
b = (Timer - a) * 100
Label1.BackColor = RGB(b, 100, 100)
End If
End Sub

搜索更多相关主题的帖子: color 天都 
2005-12-19 09:08
syh878
Rank: 1
等 级:新手上路
威 望:2
帖 子:461
专家分:0
注 册:2005-9-2
得分:0 

在timer中让背景颜色的值向上递加不就行了吗当颜色结束时,重新给变量值


2005-12-19 11:00
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
得分:0 

不知道是不是你要的效果:




Option Explicit
Dim R As Integer, G As Integer, B As Integer
Dim Step As Integer

Private Sub Command1_Click()
Timer1.Interval = 10
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Line1.X2 = Line1.X1
Timer1.Enabled = False
Command1.Caption = "Start"
End Sub

Private Sub Timer1_Timer()
If Step = 0 Then
Line1.BorderColor = vbRed
Line1.X2 = Line1.X1 + 3000 * (R / 255)
R = R + 1
G = 0
B = 0
If R = 255 Then
Step = 1
End If
ElseIf Step = 1 Then
Line1.BorderColor = vbGreen
Line1.X2 = Line1.X1 + 3000 * (G / 255)
R = 0
G = G + 1
B = 0
If G = 255 Then
Step = 2
End If
ElseIf Step = 2 Then
Line1.BorderColor = vbBlue
Line1.X2 = Line1.X1 + 3000 * (B / 255)
R = 0
G = 0
B = B + 1
If B = 255 Then
Step = 0
End If
End If
Label1.BackColor = RGB(R, G, B)
End Sub


天津网站建设 http://www./
2005-12-19 12:12
syh878
Rank: 1
等 级:新手上路
威 望:2
帖 子:461
专家分:0
注 册:2005-9-2
得分:0 
呵呵,斑竹的gif用什么做的??

2005-12-19 14:30
hl0071
Rank: 1
等 级:新手上路
帖 子:125
专家分:0
注 册:2005-11-11
得分:0 
是啊,谢谢了

一切都是快乐的
2005-12-21 20:31



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




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

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