Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在启动屏幕vb.net中使用动画gif_Vb.net_Visual Studio_Animation - Fatal编程技术网

在启动屏幕vb.net中使用动画gif

在启动屏幕vb.net中使用动画gif,vb.net,visual-studio,animation,Vb.net,Visual Studio,Animation,在已创建的visual studio 2013项目中创建.gif动画时遇到问题 一直在网上寻找“正确”的方法。下面这个MSDN问题:我复制了一些代码来看看它是如何工作的。我还看到了使用计时器的参考资料 Public Not Inheritable Class SplashScreen Private progressGifPath As String = "C:\Documents\Visual Studio 2013\Projects\CameraFinder\icons" + "\or

在已创建的visual studio 2013项目中创建.gif动画时遇到问题

一直在网上寻找“正确”的方法。下面这个MSDN问题:我复制了一些代码来看看它是如何工作的。我还看到了使用计时器的参考资料

 Public Not Inheritable Class SplashScreen

 Private progressGifPath As String = "C:\Documents\Visual Studio 2013\Projects\CameraFinder\icons" + "\orangeLoading.gif"
Private _AnimatedGif As New Bitmap(progressGifPath)

Private m_IsAnimating As Boolean
Public Property IsAnimating() As Boolean
    Get
        Return m_IsAnimating
    End Get
    Set(ByVal value As Boolean)
        m_IsAnimating = value
    End Set
End Property


Private Sub VICameraFinderLoading_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    'Set up the dialog text at runtime according to the application's assembly information.  


    If My.Application.Info.Title <> "" Then

    Else

      End If


End Sub


Private Sub PlayGIF()
    If Not m_IsAnimating Then
         ImageAnimator.Animate(_AnimatedGif, New EventHandler(AddressOf    Me.OnFrameChanged))
        m_IsAnimating = True
    End If
End Sub

Private Sub OnFrameChanged(ByVal o As Object, ByVal e As EventArgs)
    If m_IsAnimating Then
        ImageAnimator.UpdateFrames()
        Dim aGraphics As Graphics = PictureBox.CreateGraphics
        aGraphics.DrawImage(_AnimatedGif, New Point(30, 30))
        aGraphics.Dispose()
    End If
End Sub


End Class
Public不可继承类SplashScreen
Private progressGifPath As String=“C:\Documents\Visual Studio 2013\Projects\CameraFinder\icons”+“\orangeLoading.gif”
私有_AnimatedGif作为新位图(progressGifPath)
私有m_表示为布尔值
公共属性IsAnimating()为布尔值
得到
返回m_IsAnimating
结束
设置(ByVal值为布尔值)
m_IsAnimating=值
端集
端属性
私有子VICameraFinderLoading_Load(ByVal sender作为对象,ByVal e作为System.EventArgs)处理Me.Load
'根据应用程序的程序集信息在运行时设置对话框文本。
如果My.Application.Info.Title为“”,则
其他的
如果结束
端接头
专用子游戏GIF()
如果不是,那么
ImageAnimator.Animate(_AnimatedGif,新事件处理程序(AddressOf Me.OnFrameChanged))
m_IsAnimating=真
如果结束
端接头
私有子OnFrameChanged(ByVal o作为对象,ByVal e作为事件参数)
如果m_是同性恋那么
ImageAnimator.UpdateFlames()
Dim aGraphics As Graphics=PictureBox.CreateGraphics
失写。绘图图像(_AnimatedGif,新点(30,30))
失写症
如果结束
端接头
末级
所以我尝试了这个,但是我在画的图片框上没有看到任何东西(我确认看到它被带到了前面)。显然,包含的gif文件可能有大小限制。有什么更好的方法包括它的想法吗


谢谢

找到了答案。我没有将图片框的图像设置为gif

编辑:


澄清一下,上面的代码根本不是问题所在。实际上我根本不需要它。我把它从初始屏幕类中完全删除了。解决方案是进入我的图片框的属性(F4)并将背景图像设置为.gif的文件路径(从而将其作为嵌入式资源导入)。这样做可以在启动屏幕中显示动画

如果将动画gif放置到picturebox控件中,除了显示它之外,您无需执行任何其他操作。这并不提供问题的答案。若要评论或要求作者澄清,请在其帖子下方留下评论。即使这是我自己的问题?即使这是你自己的问题,你也可以a)删除它,如果它很简单,没有机会帮助其他人,或者b)以更好的方式回答它,即显示帮助你的代码。这看起来可以帮助其他人,所以可能会显示不起作用的代码和起作用的代码,这样就可以了。