Visual Basic幻灯片帮助 [英] Visual Basic Slideshow Help

查看:69
本文介绍了Visual Basic幻灯片帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好, 

Hi all, 

我一直在拼命搜索互联网,以获得有关此主题的一些帮助,但遗憾的是,这个问题很短暂。

I've been desperately scouring the internet for some help on this topic, but have unfortunately come up short.

我试图创建一个充当幻灯片的表单应用程序,并通过使用Timer_Tick事件(下面的代码)成功...但是;在与我的大学导师交谈后,
显然分配标准要求使用'While Loop'。 

I was trying to create a Form Application that acts as a slideshow, and was successful by using Timer_Tick event (code below)...however; after talking to my college tutor apparently the assignment criteria calls for the use of a 'While Loop'. 

我一直在努力一段时间现在将While循环合并到此代码的主体中,但不幸的是我将其左右分开。  

I have been trying for a while now to incorporate a While Loop into the main body of this code, but I am unfortunately breaking it left right and centre.  

如果有人有任何提示或提示我我将非常感激。 

If anyone has any hints or tips I'd be very grateful. 

亲切的问候,Will Hammond。 

Kind regards, Will Hammond. 

Public Class Form1
    Dim count As Integer

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        count = count + 1
        If count = 1 Then
            PictureBox1.Image = Image.FromFile("C:\Users\William Hammond\Desktop\JPEGs\seagull.jpeg")
        ElseIf count = 2 Then
            PictureBox1.Image = Image.FromFile("C:\Users\William Hammond\Desktop\JPEGs\car.jpg")

            count = 0
        End If
    End Sub
End Class

推荐答案


我试图创建一个充当幻灯片的表单应用程序,并通过使用Timer_Tick事件(下面的代码)成功...但是;在与我的大学导师交谈后,
显然分配标准要求使用'While Loop'。

I was trying to create a Form Application that acts as a slideshow, and was successful by using Timer_Tick event (code below)...however; after talking to my college tutor apparently the assignment criteria calls for the use of a 'While Loop'.

您应该要求解释While循环如何适合此任务。 计时器和刻度事件是进行幻灯片放映的正确方法。  Windows是事件驱动的,更改图像应该是响应事件,例如计时器滴答或鼠标点击
。  尝试使用While循环只有在你能以某种方式延迟程序间隔时才会起作用。

https://msdn.microsoft.com/en-us/library/system.threading.thread.sleep(v=vs.110)。 aspx

You should ask for an explanation of how a While loop fits this task.  A timer and the tick event is the correct way to do a slideshow.  Windows is event driven, and changing the image should be in response to an event, such as the timer tick or a mouse click.   Trying to do it with a While loop will only work if you can somehow delay the program for an interval.
https://msdn.microsoft.com/en-us/library/system.threading.thread.sleep(v=vs.110).aspx


这篇关于Visual Basic幻灯片帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆