Hi, This is an only gif player form which does it once. (Sort of splash form)
Here's the code:
In option strict = off it works fine, no errors. In option strict = on, following errors will occur:Code:Public NotInheritable Class SplashScreen Protected Overrides ReadOnly Property CreateParams As CreateParams Get CreateParams = MyBase.CreateParams CreateParams.ExStyle = CreateParams.ExStyle Or &H2000000 Return CreateParams End Get End Property Dim animatedImage = My.Resources.splash '* Dim currentlyAnimating As Boolean = False Dim framecounter As Integer = 0 Dim framecount As Integer Dim framdim As Imaging.FrameDimension Private Sub OnFrameChanged(ByVal o As Object, ByVal e As EventArgs) PictureBox1.Invalidate() End Sub Sub AnimateImage() If Not currentlyAnimating Then ImageAnimator.Animate(animatedImage, New EventHandler(AddressOf Me.OnFrameChanged)) '** currentlyAnimating = True End If End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint If framecounter < framecount Then AnimateImage() ImageAnimator.UpdateFrames() e.Graphics.DrawImage(Me.animatedImage, New Point(0, 0)) '*** framecounter += 1 Else Me.Hide() MainWindow.Show() End If End Sub Private Sub SplashScreen_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Opacity = 0 Me.Width = My.Resources.splash.Width Me.Height = My.Resources.splash.Height Me.TopMost = True framdim = New Imaging.FrameDimension(animatedImage.FrameDimensionsList(0)) '**** framecount = animatedImage.GetFrameCount(framdim) '***** End Sub End Class
* Option Strict On requires all variable declarations to have an 'As' clause.
** Option Strict On disallows implicit conversions from 'Object' to 'Image'.
*** Overload resolution failed because no accessible 'DrawImage' can be called with these arguments: (A list of 'image' and 'object's.)
**** Option Strict On disallows late binding.
***** Option Strict On disallows late binding.




Reply With Quote
