Un petit jackpot sous forme de controle activex pouvant etre utiliser dans n'importe quel application
Source / Exemple :
Private Sub aleatoire()
Randomize
Dim strLbl1, strLbl2, strLbl3 As String
strLbl1 = Chr(Int(Rnd * m_intDifficulty) + 65)
strLbl2 = Chr(Int(Rnd * m_intDifficulty) + 65)
strLbl3 = Chr(Int(Rnd * m_intDifficulty) + 65)
lbl1.Caption = strLbl1
lbl2.Caption = strLbl2
lbl3.Caption = strLbl3
If strLbl1 = strLbl2 And strLbl2 = strLbl3 Then
RaiseEvent jackpot
End If
End Sub
Private Sub lbl1_Click()
aleatoire
End Sub
Private Sub lbl2_Click()
aleatoire
End Sub
Private Sub lbl3_Click()
aleatoire
End Sub
Private Sub UserControl_Initialize()
m_intDifficulty = 3
Debug.Print "dans initialize"
End Sub
Private Sub UserControl_InitProperties()
Debug.Print "dans initPropertie"
End Sub
Private Sub UserControl_Paint()
Debug.Print "Paint"
End Sub
Public Property Get Difficulty() As Variant
Attribute Difficulty.VB_ProcData.VB_Invoke_Property = "difficulté"
Difficulty = m_intDifficulty - 2
End Property
Public Property Let Difficulty(ByVal vNewValue As Variant)
If 3 > vNewValue And vNewValue > 1 Then
m_intDifficulty = vNewValue + 2
Else
m_intDifficulty = 1
End If
PropertyChanged Difficulty
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
m_intDifficulty = PropBag.ReadProperty("Difficulty", 1) + 2
lbl3.BackColor = PropBag.ReadProperty("background", "&H80000005")
lbl2.BackColor = PropBag.ReadProperty("background", "&H80000005")
lbl1.BackColor = PropBag.ReadProperty("background", "&H80000005")
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "Difficulty", m_intDifficulty - 2, 1
PropBag.WriteProperty "background", lbl1.BackColor, "&H80000005"
End Sub
Public Property Get background() As OLE_COLOR
Attribute background.VB_ProcData.VB_Invoke_Property = "StandardColor"
If lbl1.BackColor = lbl2.BackColor And lbl2.BackColor = lbl3.BackColor Then
bakground = lbl1.BackColor
End If
End Property
Public Property Let background(ByVal vNewValue As OLE_COLOR)
lbl1.BackColor = vNewValue
lbl2.BackColor = vNewValue
lbl3.BackColor = vNewValue
PropertyChanged background
End Property
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.