使用进度条显示另一种形式 [英] using progress bar to show another form

查看:91
本文介绍了使用进度条显示另一种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在Visual Basic 2008中制作一个表单,该表单使用计时器和进度条加载另一个表单.

在计时器中,我有以下代码:



i am making a form in visual basic 2008 which uses a timer and progress bar to load another form.

in the timer i have the following code:

Loading.Increment(1)
If Loading.Value = Loading.Maximum Then
   AboutBox.Show()
End If


因此,在进度条达到最大值后,将显示AboutBox.但我希望它关闭此进度栏所在的表单.

如果我使用Me.Close(),则它将关闭整个程序.我如何在不停止整个程序的情况下关闭表格?即使关闭程序,它也可以使AboutBox永远保持打开状态,有没有一种方法可以使窗体保持一定时间打开?

并有一种方法可以在程序启动时不使用按钮自动启动计时器?

谢谢
amir


so the AboutBox shows up after the progress bar has reached maximum. but i want it close the form where this progress bar is.

if i use Me.Close() then it closes the whole programme. how can i close the form without stopping the whole programme? it also keeps the AboutBox open forever even if you close the programme is there a way of keeping a form open for a certain time?

and is there a way of starting the timer automatically when the programme starts without using a button?

thanks
amir

推荐答案

要查看Me.Close为什么关闭整个程序,您需要查看项目的属性.转到应用程序"选项卡,您将看到一个显示"Windows应用程序框架属性"的框.关机模式自动设置为当启动表单关闭时".因此,当第一个窗体关闭时,应用程序也会关闭.您可以将其更改为何时关闭最后一个表单",这样就不会有问题.

至于关闭关于"框,只需将一个计时器添加到关于"框,并在计时器到达其时间时将其关闭.

而且,是的,当然有一种自动启动计时器的方法.这称为表单的Load事件.如果您双击一个新创建的表单,它将带您进入Load事件.将代码放在此处以启动计时器,该计时器将在表单加载时启动.
To see why Me.Close closes the whole program, you need to look at the properties of your project. Go to the Application Tab and you''ll see a box that says "Windows application framework properties". The Shutdown mode is automatically set to "When startup form closes". So, when the first form closes, so will the application. You can change that to "When last form closes" and you won''t have that problem.

As far as closing the About box, just add a timer to the about box and close it when the timer reaches it''s time.

And, yes, of course there''s a way to start the timer automatically. It''s called the form''s Load event. If you double-click on a newly created form, it will take you to the Load event. Place the code there to start the timer and it will start when the form loads.


在pageLoad()
启动计时器
Start the timer at pageLoad()
sub Form1_Load()
   Timer1.Interval = 1000 
   Timer1.Start
end sub



隐藏FirstForm,然后显示计时器何时达到最大值



Hide the FirstForm and then show the when timer reaches the maximum value

If Timer1.Value = Timer1.Maximum Then
  Me.Hide()
  form2.Show()
End If



问候



regards


这篇关于使用进度条显示另一种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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