Der nachfolgende Tipp zeigt, wie man Hotspot-Aktionen festlegen kann. Hotspots sind Bereiche, bei denen beim "Darüberfahren" und/oder Klicken mit der Maus eine bestimmte Aktion ausgelöst wird. Im nachfolgenden Beispiel wird ein Sound abgespielt, wenn Sie die Maus über einen sogenannten Hotspot-Bereich (Picture-Objekt) bewegen. Klicken Sie auf das Picture-Objekt, so ändert sich das Bild. Um den Tipp besser nachvollziehen zu können, empfehlen wir Ihnen sich das Beispiel "downzuloaden". ' IN FORM: ' Beispiel : HOTSPOT... ' Begin Code Option Explicit Const conNORMALSTATUS = 1 Const conAKTIVERSTATUS = 2 Const conKLICKSTATUS = 3 Dim intStaSpot As Integer Dim intAktSpot As Integer Private Sub Form_MouseMove(Button As Integer, _ Shift As Integer, X As Single, Y As Single) If intStaSpot = conAKTIVERSTATUS Then HotSpot(intAktSpot).Picture = Picture1.Picture intStaSpot = conNORMALSTATUS intAktSpot = -1 End If End Sub Private Sub HotSpot_MouseDown(Index As Integer, _ Button As Integer, Shift As Integer, X As Single, _ Y As Single) Dim intTmp As Integer If intStaSpot <> conKLICKSTATUS Then HotSpot(Index).Picture = Picture3.Picture intTmp = sndPlaySound(ByVal (App.Path + _ "\ding.wav"), SYNC) intStaSpot = conKLICKSTATUS intAktSpot = Index End If End Sub Private Sub HotSpot_MouseMove(Index As Integer, _ Button As Integer, Shift As Integer, X As Single, _ Y As Single) Dim intTmp As Integer If intStaSpot = conNORMALSTATUS Then HotSpot(Index).Picture = Picture2.Picture intTmp = sndPlaySound(ByVal (App.Path + _ "\boing.wav"), SYNC) intStaSpot = conAKTIVERSTATUS intAktSpot = Index End If End Sub Private Sub HotSpot_MouseUp(Index As Integer, _ Button As Integer, Shift As Integer, X As Single, _ Y As Single) If intStaSpot <> conAKTIVERSTATUS Then HotSpot(Index).Picture = Picture2.Picture intStaSpot = conAKTIVERSTATUS intAktSpot = Index End If End Sub Private Sub Form_Initialize() Dim intZaehler As Integer intStaSpot = 1 intAktSpot = -1 For intZaehler = 0 To Me.Controls.Count - 1 If Me.Controls(intZaehler).Name = "HotSpot" Then Me.Controls(intZaehler).Picture = Picture1.Picture End If Next End Sub ' End Code Form ' In Modul: ' Begin Code Option Explicit Declare Function sndPlaySound Lib "winmm" _ Alias "sndPlaySoundA" ( _ ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Public Const SYNC = 1 ' End Cod Dieser Tipp wurde bereits 16.247 mal aufgerufen. Voriger Tipp | Zufälliger Tipp | Nächster Tipp
Anzeige
Diesen und auch alle anderen Tipps & Tricks finden Sie auch auf unserer aktuellen vb@rchiv Vol.6 (einschl. Beispielprojekt!) Ein absolutes Muss - Geballtes Wissen aus mehr als 8 Jahren vb@rchiv! - nahezu alle Tipps & Tricks und Workshops mit Beispielprojekten - Symbol-Galerie mit mehr als 3.200 Icons im modernen Look Weitere Infos - 4 Entwickler-Vollversionen (u.a. sevFTP für .NET), Online-Update-Funktion u.v.m. |
sevWizard für VB5/6 Professionelle Assistenten im Handumdrehen Erstellen Sie eigene Assistenten (Wizards) im Look & Feel von Windows 2000/XP - mit allem Komfort und zwar in Windeseile :-) Tipp des Monats Mai 2024 Hermann Röttger Wochentage eines Datumsbereichs ermitteln Wochentage eines Datumsbereichs ermitteln, optional mit Feiertagsberechnung Access-Tools Vol.1 Über 400 MByte Inhalt Mehr als 250 Access-Beispiele, 25 Add-Ins und ActiveX-Komponenten, 16 VB-Projekt inkl. Source, mehr als 320 Tipps & Tricks für Access und VB |
||||||||||||||||
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein. |