可以利用鼠标移动到矩形框上的时候,获取该矩形框的名称,根据这个string变量做出一个判断,可以做到一个类似退出的效果。
鼠标交替在两个矩形框上面移动,可以看到效果。
==================================
Option Compare Database
Option Explicit
Private Sub Rectangle_properties(ByVal Rectanglename As String)
'-----------------------------------------------------
'Dim frm As Form
'Set frm = Screen.ActiveForm ' 返回指向活动窗体的 Form 对象。
Dim CtlA As Access.Control
'循环处理活动窗体的所有控件
For Each CtlA In Me.Controls
If CtlA.ControlType = acRectangle Then '针对 矩形 控件进行遍历设置
If CtlA.Name = Rectanglename Then
With CtlA
' .borderwith = 3
.BackStyle = 1
.BorderColor = 16744448
.BorderStyle = 1
End With
Else
With CtlA
' .borderwith = 1
.BackStyle = 0
.BorderColor = 0
.BorderStyle = 0
End With
End If
End If
Next CtlA
End Sub
Private Sub 矩形1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call Rectangle_properties(Me.矩形1.Name)
End Sub
Private Sub 矩形2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call Rectangle_properties(Me.矩形2.Name)
End Sub
[此贴子已经被作者于2006-3-31 20:35:49编辑过]
|