标题:求 vb 锁定红色控件背景色代码
只看楼主
baofengjfq
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-2-11
结帖率:0
 问题点数:0 回复次数:0 
求 vb 锁定红色控件背景色代码
拜师学艺 求vb锁定某个控件背景色.rar (4.7 KB)
    在多个相同控件里,某一个控件变为红色后让其锁定,也就是当鼠标点击另一个控件时,已成为红色的不再改变成白色。请帮忙修改如下代码:
Private CurrenNum As Integer
Private Sub Command1_Click()
Picture2(i).BackColor = vbRed
End Sub

Private Sub Form_Load()
   CurrenNum = 0
   Call Picture2_Click(CurrenNum)
End Sub

Private Sub Label1_Click()

If CurrenNum < 35 Then
   CurrenNum = CurrenNum + 1
   Call Picture2_Click(CurrenNum)
End If
  
End Sub

Private Sub Label2_Click()

If CurrenNum > 0 Then
   CurrenNum = CurrenNum - 1
   Call Picture2_Click(CurrenNum)
End If

End Sub

Private Sub Picture2_Click(Index As Integer)

   Call 还原背景为白色
 
   Picture2(Index).Cls
   Picture2(Index).BackColor = &H80000003
   If i + 1 < 10 Then
      Picture2(Index).Print " " & CStr(Index + 1)
   Else
      Picture2(Index).Print CStr(Index + 1)
   End If
 
    CurrenNum = Index
 
End Sub

Private Sub 还原背景为白色()
Dim i As Integer
For i = 0 To 35
   Picture2(i).BackColor = vbWhite
   Picture2(i).Cls
   Picture2(i).Print CStr(i + 1)
Next i
End Sub
搜索更多相关主题的帖子: 背景色 
2014-06-28 14:36



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




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

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