Results 1 to 3 of 3

Thread: [RESOLVED] Option strict implicit/disallow errors on a simple form

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Resolved [RESOLVED] Option strict implicit/disallow errors on a simple form

    Hi, This is an only gif player form which does it once. (Sort of splash form)
    Here's the code:
    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
    In option strict = off it works fine, no errors. In option strict = on, following errors will occur:

    * 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.
    Last edited by pourkascheff; Feb 12th, 2023 at 04:13 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width