Kod:
Option Compare Database
Option Explicit
Private Const LABEL_RAISED_BackColor = 14474460
Private Const LABEL_SUNKEN_BackColor = 15785160
Dim lngLabelCurrentColor As Long
Public Sub LabelSpecialEffect(frm As Form, Optional intEffect As Integer = 2)
On Error Resume Next
Dim ctl As Control
Dim strControlName As String
For Each ctl In frm.Controls
With ctl
If .ControlType = acTextBox Or .ControlType = acComboBox Then
.BorderStyle = 1
.BorderColor = 0
.BorderWidth = 3
.SpecialEffect = intEffect
With .Controls(0)
strControlName = .Name
.Caption = ctl.Name
.BorderStyle = 1
.BorderColor = 0
.BorderWidth = 3
.BackStyle = 1
.BackColor = LABEL_RAISED_BackColor
.SpecialEffect = 1
End With
.OnEnter = "=SetLableStyle(" & strControlName & ",2)"
.OnExit = "=SetLableStyle(" & strControlName & ",1)"
End If
End With
Next
End Sub
Public Function SetLableStyle(ctl As Control, Optional intEffect As Integer = 2)
On Error Resume Next
Select Case intEffect
Case 1
lngLabelCurrentColor = LABEL_RAISED_BackColor
Case 2
lngLabelCurrentColor = LABEL_SUNKEN_BackColor
End Select
With ctl
.BackStyle = 1
.BackColor = lngLabelCurrentColor
.SpecialEffect = intEffect
End With
End Function
formun yüklemesine
Kod:
Private Sub Form_Load()
LabelSpecialEffect Me
End Sub
Kod:
.OnEnter = "=SetLableStyle(" & strControlName & ",2)"
.OnExit = "=SetLableStyle(" & strControlName & ",1)"