![]() |
Tipp 0127
|
Animierte Gif-Grafiken mit WebBrowser-Control
|
 |
|
Autor/Einsender: Datum: |
|
Detlev Schubert 29.03.2005 (Update) |
|
Entwicklungsumgebung: |
|
VB 6 |
|
|
Obwohl die PictureBox Gif-Grafiken anzeigen kann, wird bei animierten Gif-Grafiken nur
das erste Bild angezeigt. Einer der einfachsten Wege ein animiertes Gif anzuzeigen,
ist das Einbinden des Webbrowser-Controls.
|
Dies funktioniert ab dem Internet-Explorer 4.0. Dazu muss lediglich die
WebBrowser-ActiveX-Komponente in das Projekt eingebunden werden.
Beachten Sie auch, dass bei dem Body-Attribut scroll='no'
eingestellt ist, um die ScrollBars zu deaktivieren.
|
|
|
Option Explicit
Private Sub Form_Load()
With Me.Combo1
.Clear
.AddItem "crazycounter"
.AddItem "fireanim"
.AddItem "gif"
.ListIndex = 0
End With
End Sub
Private Sub Combo1_Click()
Dim strImgPath As String
strImgPath = AppPath & Combo1.List(Combo1.ListIndex) & ".gif"
WebBrowser1.Navigate "about:<html><body scroll='no'>" & _
"<img src=" & Chr$(34) & strImgPath & Chr$(34) & _
"></img></body></html>"
End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, _
URL As Variant)
With WebBrowser1
.Document.body.Style.Border = "none"
.Document.body.Style.backgroundcolor = "buttonface"
.Document.body.Style.overflow = "hidden"
End With
End Sub
Private Function AppPath() As String
If Right$(App.Path, 1) = "\" Then
AppPath = App.Path
Else
AppPath = App.Path & "\"
End If
End Function
|
|
|
|
Im Download befindet sich auch ein Excel/VBA-Beispiel.
|
|
|
Um diesen Tipp ausführen zu können, muss der Internet Explorer ab Version 4
installiert sein.
|
|
Windows-Version |
95 |
 |
|
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
VB-Version |
VBA 5 |
 |
|
VBA 6 |
 |
|
VB 4/16 |
 |
|
VB 4/32 |
 |
|
VB 5 |
 |
|
VB 6 |
 |
|
|
|
Download (68,8 kB)
|
Downloads bisher: [ 3716 ]
|
|
|