| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 397 人关注过本帖
标题:看一看这段程序哪里错了
只看楼主 加入收藏
shuangziputi
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-4-28
收藏
 问题点数:0 回复次数:2 
看一看这段程序哪里错了

private Sub Form_Load()
Dim Count As Integer
Dim LblBtn() As String
For Count = 0 To 3 '请将此出的3换成你的LblBtn数量的个数-1
LblBtn(Count).BackColor = LBL_BACK_COLOR '初始化LblBtn的背景
Next Count
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Count As Integer
DoEvents
For Count = 0 To 3
LblBtn(Count).BackColor = LBL_BACKCOLOR '恢复背景
Next Count
End Sub

Private Sub LblBtn_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
LblBtn(Index).BackColor = LBL_WHEN_MOUSE_DOWN '临时改变LblBtn背景颜色
End Sub
Private Sub LblBtn_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Count As Integer
DoEvents '暂时将系统控制权教给系统
If Button Then Exit Sub '如果按钮被按下就退出该过程
For Count = 0 To 3
If Count <> Index Then '如果按下的不是其它按钮
LblBtn(Index).BackColor = LBL_BACK_COLOR '将背景设为正常
Else
LblBtn(Index).BackColor = LBL_WHEN_MOUSE_MOVE '将背景设为鼠标移动的背景
End If
Next Count
End Sub

Private Const LBL_BACK_COLOR = &HE0E0E0 '正常时Label控件的背景色
Private Const LBL_WHEN_MOUSE_MOVE = &HC0C0C0 '鼠标移动时Label的背景色
Private Const LBL_WHEN_MOUSE_DOWN = &H808080 '鼠标按下时Label的背景色

[此贴子已经被作者于2007-4-29 22:21:47编辑过]

搜索更多相关主题的帖子: 背景 private 
2007-04-29 22:14
hyhhd
Rank: 2
等 级:论坛游民
威 望:1
帖 子:502
专家分:44
注 册:2006-5-12
收藏
得分:0 

帮你改了一下:
Private LBL_BACK_COLOR As Long '正常时Label控件的背景色
Private LBL_WHEN_MOUSE_MOVE As Long '鼠标移动时Label的背景色
Private LBL_WHEN_MOUSE_DOWN As Long '鼠标按下时Label的背景色


Private Sub Form_Load()
Dim Count As Integer

LBL_BACK_COLOR = &HE0E0E0
LBL_WHEN_MOUSE_MOVE = &HC0C0C0
LBL_WHEN_MOUSE_DOWN = &H808080

For Count = 0 To 3 '请将此出的3换成你的LblBtn数量的个数-1
Label1(Count).BackColor = LBL_BACK_COLOR '初始化LblBtn的背景

Next Count

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Count As Integer

DoEvents
For Count = 0 To 3
Label1(Count).BackColor = LBL_BACK_COLOR '恢复背景

Next Count

End Sub

Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1(Index).BackColor = LBL_WHEN_MOUSE_DOWN '临时改变LblBtn背景颜色

End Sub

Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Count As Integer

DoEvents '暂时将系统控制权教给系统

If Button Then
Exit Sub '如果按钮被按下就退出该过程

End If

For Count = 0 To 3
If Count = Index Then
Label1(Index).BackColor = LBL_WHEN_MOUSE_MOVE '将背景设为鼠标移动的背景
Else
Label1(Count).BackColor = LBL_BACK_COLOR

End If
Next

End Sub


2007-04-29 22:44
hyhhd
Rank: 2
等 级:论坛游民
威 望:1
帖 子:502
专家分:44
注 册:2006-5-12
收藏
得分:0 

或者:
Option Explicit

Private Const LBL_BACK_COLOR = &HE0E0E0 '正常时Label控件的背景色
Private Const LBL_WHEN_MOUSE_MOVE = &HC0C0C0 '鼠标移动时Label的背景色
Private Const LBL_WHEN_MOUSE_DOWN = &H808080 '鼠标按下时Label的背景色


Private Sub Form_Load()
Dim Count As Integer

For Count = 0 To 3 '请将此出的3换成你的LblBtn数量的个数-1
Label1(Count).BackColor = LBL_BACK_COLOR '初始化LblBtn的背景

Next Count

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Count As Integer

DoEvents
For Count = 0 To 3
Label1(Count).BackColor = LBL_BACK_COLOR '恢复背景

Next Count

End Sub

Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1(Index).BackColor = LBL_WHEN_MOUSE_DOWN '临时改变LblBtn背景颜色

End Sub

Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Count As Integer

DoEvents '暂时将系统控制权教给系统

If Button Then
Exit Sub '如果按钮被按下就退出该过程

End If

For Count = 0 To 3
If Count = Index Then
Label1(Index).BackColor = LBL_WHEN_MOUSE_MOVE '将背景设为鼠标移动的背景
Else
Label1(Count).BackColor = LBL_BACK_COLOR

End If
Next

End Sub


2007-04-29 22:48
快速回复:看一看这段程序哪里错了
数据加载中...
 
   



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

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