1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
Dim Rev As String
Event Alarme(Beep) ' Ici je déclare mon événement Alarme
Private Sub UserControl1_Initialize()
FontSize = Label1.FontSize
End Sub
Private Sub Check1_Click()
If (Check1.Value = 1) & (Text1.Text = Format(Text1.Text, "HH:mm:ss")) Then ' Ici j'essaye de vérifier si le format rentré est correct
Text1.Locked = False
Text1.Enabled = False
End If
If (Check1.Value = 1) & (Text1.Text <> Format(Label1, "HH:mm:ss")) Then
MsgBox ("Format de l'heure invalide (HH:mm:ss)")
End If
If Check1.Value = 0 Then
Text1.Enabled = True
End If
End Sub
Private Sub Text1_Change()
Rev = Text1.Text
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = True
Label1.Caption = Time
If Rev = Label1.Caption Then
RaiseEvent Alarme(200)
End If
End Sub
'/////////Les propriétés///////////
Public Property Get FontSize() As Integer
FontSize = Label1.FontSize
End Property
Public Property Let FontSize(ByVal New_FontSize As Integer)
Let Label1.FontSize = New_FontSize
PropertyChanged "FontSize"
End Property
Public Property Get HeureAlarme() As String
HeureAlarme = Text1.Text
End Property
Public Property Let HeureAlarme(ByVal New_Heure As String)
Let Text1.Text = New_Heure
PropertyChanged "HeureAlarme"
End Property
Public Property Get AlarmeActive() As Boolean
AlarmeActive = Check1.Enabled
End Property
Public Property Let AlarmeActive(ByVal New_AlarmeActive As Boolean)
Let Check1.Enabled = New_AlarmeActive
PropertyChanged "AlarmeActive"
End Property
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("FontSize", Label1.FontSize, 8)
Call PropBag.WriteProperty("HeureAlarme", Text1.Text, "")
Call PropBag.WriteProperty("AlarmeActive", Check1.Enabled, True)
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Label1.FontSize = PropBag.ReadProperty("FontSize", 8)
Text1.Text = PropBag.ReadProperty("HeureAlarme", "")
Check1.Enabled = PropBag.ReadProperty("AlarmeActive", True)
End Sub
'///////Les méthodes////////
Public Sub Show(Affiche As Boolean)
If UserControl1(Affiche) = True Then
Check1.Visible = True
Text1.Text = True
End Sub
Public Sub Hide(Cache As Boolean)
If UserControl1(Cache) = False Then
Check1.Visible = False
Text1.Text = False
End Sub |
Partager