Office中国论坛/Access中国论坛
标题: [求助]黄海老师的源码,看不懂,谁能帮我解释?谢~~ [打印本页]
作者: pcyclone 时间: 2006-1-21 21:05
标题: [求助]黄海老师的源码,看不懂,谁能帮我解释?谢~~
[attach]15504[/attach]
看不懂颜色怎么变化的,文本框怎么和选项卡关联,还有。。。。。
Option Compare Database
Option Explicit
Private Sub Form_Load()
Call lblClick([Label0])
End Sub
Public Function lblClick(lbl As Label)
Dim Ctrl As Control
Me.cmdGetFocus.SetFocus
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is Label Then
If lbl.Name = Ctrl.Name Then
Ctrl.BackColor = Ctrl.Tag
Ctrl.BorderColor = Ctrl.Tag
Me.Box2.BackColor = Ctrl.BackColor
Me.Detail.BackColor = Ctrl.BackColor
Me.lblTitle.Caption = Ctrl.Caption
Me.Box3.BorderColor = Ctrl.BackColor
Else
Ctrl.BackColor = 15000804
Ctrl.BorderColor = 12632256
End If
End If
If TypeOf Ctrl Is Page Then
If Ctrl.Name = "页" & CStr(Int(Right(lbl.Name, 1)) + 1) Then
Ctrl.Visible = True
Else
Ctrl.Visible = False
End If
End If
Next Ctrl
End Function
[此贴子已经被作者于2006-1-21 13:05:56编辑过]
作者: fan0217 时间: 2006-1-23 03:39
Public Function lblClick(lbl As Label)
Dim Ctrl As Control
Me.cmdGetFocus.SetFocus
For Each Ctrl In Me.Controls '历遍所有控件
If TypeOf Ctrl Is Label Then '如果控件为标签
If lbl.Name = Ctrl.Name Then
Ctrl.BackColor = Ctrl.Tag '设置控件背景为控件标记属性里的值,下同
Ctrl.BorderColor = Ctrl.Tag
Me.Box2.BackColor = Ctrl.BackColor
Me.Detail.BackColor = Ctrl.BackColor
Me.lblTitle.Caption = Ctrl.Caption
Me.Box3.BorderColor = Ctrl.BackColor
Else
Ctrl.BackColor = 15000804
Ctrl.BorderColor = 12632256
End If
End If
If TypeOf Ctrl Is Page Then
If Ctrl.Name = "页" & CStr(Int(Right(lbl.Name, 1)) + 1) Then
Ctrl.Visible = True
Else
Ctrl.Visible = False
End If
End If
Next Ctrl
End Function
[此贴子已经被作者于2006-1-22 19:39:09编辑过]
作者: 3leaf 时间: 2006-1-24 20:11
看不懂哦
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) |
Powered by Discuz! X3.3 |