问:OnLoad [英] Q: OnLoad

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

问题描述

如果我想要一个来自显示的OpenFileDialog

,那么有人能告诉我我应该使用的事件吗?我尝试将它放在OnLoad

表格中,但这意味着在OpenFileDialog

关闭之前表格并没有完全显示。


非常感谢提前


Geoff

Can anybody tell me the event I should use if I want a OpenFileDialog to
open as soon as a from has displayed? I tried putting it in the forms OnLoad
but this means that the form isn''t fully displayed until the OpenFileDialog
is shutdown.

Many thanks in advance

Geoff

推荐答案

Geoff,


在调用openfiledialog的ShowDialog方法之前尝试放置Me.Show。


Kerry Moorman

" Geoff Jones"写道:
Geoff,

Try putting Me.Show before calling the openfiledialog''s ShowDialog method.

Kerry Moorman
"Geoff Jones" wrote:
任何人都可以告诉我如果我希望OpenFileDialog在显示后立即打开,我应该使用哪个事件?我尝试将它放在OnLoad形式
中,但这意味着在OpenFileDialog关闭之前表格并没有完全显示。

非常感谢提前

Geoff
Can anybody tell me the event I should use if I want a OpenFileDialog to
open as soon as a from has displayed? I tried putting it in the forms OnLoad
but this means that the form isn''t fully displayed until the OpenFileDialog
is shutdown.

Many thanks in advance

Geoff



Geoff,

您是否考虑过使用Activate活动?


类似于:


受保护的覆盖Sub OnLoad(ByVal e As System.EventArgs)

MyBase.OnLoad(e)

AddHandler Me.Activated,AddressOf MainForm_InitialOpen

End Sub


Private Sub MainForm_InitialOpen(ByVal sender As Object,ByVal e As

System.EventArgs)

RemoveHandler Me.Activated,AddressOf MainForm_InitialOpen

Dim对话框As New OpenFileDialog

dialog.ShowDialog(我)

结束子


AddHandler& RemoveHandler确保MainForm_InitialOpen仅被调用一次。


如果我有许多需要InitialOpen的表单。事件我会

考虑将上面的代码放在一个引发InitialOpen

事件的基类中,当第一个Activated事件被调用时......


我的另一个想法是Application.Idle事件,你也只允许

被调用一次。


希望这有助于

Jay


" Geoff Jones" <无******** @ email.com>在留言中写道

news:43 ********************* @ news.dial.pipex.com ..

|如果我想要一个OpenFileDialog来支付
|,有人能告诉我我应该使用的事件一旦从显示中打开?我试着把它放在表格中

OnLoad

|但这意味着表格直到

OpenFileDialog

|才会完全显示。关闭。

|

|非常感谢提前

|

| Geoff

|

|
Geoff,
Have you considered using the Activate event?

Something like:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
AddHandler Me.Activated, AddressOf MainForm_InitialOpen
End Sub

Private Sub MainForm_InitialOpen(ByVal sender As Object, ByVal e As
System.EventArgs)
RemoveHandler Me.Activated, AddressOf MainForm_InitialOpen
Dim dialog As New OpenFileDialog
dialog.ShowDialog(Me)
End Sub

The AddHandler & RemoveHandler ensure that MainForm_InitialOpen is only
called once.

If I had a number of forms that need the "InitialOpen" event I would
consider putting the above code in a base class that raises an InitialOpen
event, when the first Activated event is called...

My other thought was the Application.Idle event, that you also only allow to
be called once.

Hope this helps
Jay

"Geoff Jones" <no********@email.com> wrote in message
news:43*********************@news.dial.pipex.com.. .
| Can anybody tell me the event I should use if I want a OpenFileDialog to
| open as soon as a from has displayed? I tried putting it in the forms
OnLoad
| but this means that the form isn''t fully displayed until the
OpenFileDialog
| is shutdown.
|
| Many thanks in advance
|
| Geoff
|
|


谢谢Jay,这是最有用的。


Geoff


消息新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Thanks Jay, that is most useful.

Geoff

"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
Geoff,
您是否考虑过使用Activate事件?

类似于:

受保护的覆盖Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad (e)
AddHandler Me.Activated,AddressOf MainForm_InitialOpen
End Sub
私有子MainForm_InitialOpen(ByVal发送者为对象,ByVal e As
System.EventArgs)
RemoveHandler Me.Activated,AddressOf MainForm_InitialOpen
Dim对话框As New OpenFileDialog
dialog.ShowDialog(Me)
End Sub

AddHandler& RemoveHandler确保只调用MainForm_InitialOpen一次。

如果我有许多需要InitialOpen的表单。事件我会考虑将上面的代码放在一个引发InitialOpen
事件的基类中,当第一个Activated事件被调用时......

我的另一个想法是应用程序.Idle事件,你也只允许
被叫一次。

希望这有帮助
杰伊

杰夫琼斯 ; <无******** @ email.com>在消息中写道
新闻:43 ********************* @ news.dial.pipex.com ..
|任何人都可以告诉我如果我想要一个OpenFileDialog来我应该使用的事件
|一旦从显示中打开?我试着把它放在表格中
OnLoad
|但这意味着直到
OpenFileDialog
|表格才能完全显示关机。
|
|非常感谢提前
|
|杰夫
|
|
Geoff,
Have you considered using the Activate event?

Something like:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
AddHandler Me.Activated, AddressOf MainForm_InitialOpen
End Sub

Private Sub MainForm_InitialOpen(ByVal sender As Object, ByVal e As
System.EventArgs)
RemoveHandler Me.Activated, AddressOf MainForm_InitialOpen
Dim dialog As New OpenFileDialog
dialog.ShowDialog(Me)
End Sub

The AddHandler & RemoveHandler ensure that MainForm_InitialOpen is only
called once.

If I had a number of forms that need the "InitialOpen" event I would
consider putting the above code in a base class that raises an InitialOpen
event, when the first Activated event is called...

My other thought was the Application.Idle event, that you also only allow
to
be called once.

Hope this helps
Jay

"Geoff Jones" <no********@email.com> wrote in message
news:43*********************@news.dial.pipex.com.. .
| Can anybody tell me the event I should use if I want a OpenFileDialog to
| open as soon as a from has displayed? I tried putting it in the forms
OnLoad
| but this means that the form isn''t fully displayed until the
OpenFileDialog
| is shutdown.
|
| Many thanks in advance
|
| Geoff
|
|



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

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