|
'===============================================================================
'-函数名称: gt_LockControls
'-功能描述: 锁定或解锁窗体上的控件
'-输入参数说明: 参数1:rfrm Form 主窗体
' 参数2:rblnLocked Boolean 锁定状态 True锁定 False解锁
'-返回参数说明: 无
'-使用语法示例: gt_LockControls me,true
'-参考:
'-使用注意: 只适用Label TextBox CommandButton ComboBox OptionButton CheckBox
'-兼容性: 97,2000,XP compatible
'-作者: 王宇虹,改进:王宇虹
'-更新日期: 2012-02-24
'===============================================================================
Public Function gt_LockControls(rfrm As Form, rblnLocked As Boolean)
On Error Resume Next
Dim ctrl As Control
For Each ctrl In rfrm.Controls
If (ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox Or ctrl.ControlType = acCheckBox Or ctrl.ControlType = acListBox) Then
ctrl.Locked = rblnLocked
Else
If (ctrl.ControlType = acCommandButton And InStr(ctrl.Tag, "Lock")) > 0 Then
ctrl.Enabled = Not rblnLocked
End If
End If
Next
End Function
|
|