对话框和通知图标的问题 [英] Problem with Dialog Boxes and Notify Icons

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

问题描述

你好,这可能真的很愚蠢,但我使用的是一个对话框作为我的主要

表单,我的启动表单是我的启动画面 - 实现了一些

进度条加载一些相关数据。完成后,加载

表单会这样做:


Me.Visible = False

mainform.ShowDialog()

Application.Exit()


到目前为止一直这么好(这是一种愚蠢的方式吗???)。现在,我是

在mainform中实现一个通知图标。这是一些相关的东西:


(类变量显示为boolean = true并且通知图标设置正确)


Private Sub Open_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理NotifyIcon1.DoubleClick

Me.WindowState = FormWindowState.Normal

Me。 ShowInTaskbar = True

显示=真

NotifyIcon1.Visible = False

结束子


私人Sub MainFormSizeChanged(ByVal sender As Object,ByVal e As

System.EventArgs)处理MyBase.SizeChanged

如果显示And Me.WindowState = FormWindowState.Minimized那么

显示= False

Me.ShowInTaskbar = False

NotifyIcon1.Visible = True

结束如果

结束Sub


问题出现了:当我点击mainform上的ol最小化按钮时,

应用程序控件被传回加载并退出应用程序

因为这是下一行。我做错了什么/我可以调整什么

当窗体最小化时控件不会重新加载?


加,任何有关改善的提示肯定是受欢迎的!


谢谢!

Hi there, this is probably really dumb, but I am using a dialog as my main
form and my startup form is my splash screen - which implements some
progress bars to load up some relevant data. When that is done, loading
form does this:

Me.Visible = False
mainform.ShowDialog()
Application.Exit()

So far so good (is this a dumb way of doing that???). Now, I am
implementing a notification icon in mainform. Here is some relevant stuff:

(class variable shown as boolean = true and notify icon set up correctly)

Private Sub Open_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NotifyIcon1.DoubleClick
Me.WindowState = FormWindowState.Normal
Me.ShowInTaskbar = True
shown = True
NotifyIcon1.Visible = False
End Sub

Private Sub MainFormSizeChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.SizeChanged
If shown And Me.WindowState = FormWindowState.Minimized Then
shown = False
Me.ShowInTaskbar = False
NotifyIcon1.Visible = True
End If
End Sub

Here is the problem: When I hit the ol minimize button on mainform, the
application control is passed back to loading and the application exits
since that is the next line. What am I doing wrong/what can I adjust so
that control doesn''t go back to loading when the form is minimized??

Plus, any tips on making that better are certainly welcome!

Thanks!

推荐答案

" Derek Martin" < DM ***** @ DONTSPAMMEokstate.edu> schrieb
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
你好,这可能真的很蠢,但我使用的是一个对话框作为我的主要表单,我的启动表单是我的启动画面 - 它实现了一些进度条加载一些相关数据。完成后,
加载表单执行此操作:

Me.Visible = False
mainform.ShowDialog()
Application.Exit()
<到目前为止一直这么好(这是一种愚蠢的做法吗?)。


IMO不是个好主意。如果

表单从应用程序结束时始终可见,您应该只使用表单作为启动对象。

[...]
Hi there, this is probably really dumb, but I am using a dialog as my
main form and my startup form is my splash screen - which implements
some progress bars to load up some relevant data. When that is done,
loading form does this:

Me.Visible = False
mainform.ShowDialog()
Application.Exit()

So far so good (is this a dumb way of doing that???).
IMO not a good idea. You should only use a Form as the startup object if the
Form will always be visible from the start til the end of the application.
[...]
Here is the problem: When I hit the ol minimize button on mainform,
the application control is passed back to loading and the application
exits since that is the next line. What am I doing wrong/what can I
adjust so that control doesn''t go back to loading when the form is
minimized??



$ b当窗体最小化时,$ b ShowDialog可能会退出。如果你改变了上面写的那个

,这个问题也应该已经解决了。

-

Armin


如何报价以及原因:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



ShowDialog probably exits when the Form is minimized. If you change what
I''ve written above, this problem should have been solved also.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


我可以忍受: - )

关于如何在主要的

表单中完成启动画面的任何建议????

谢谢!

Derek


" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:40 *********************** @ news.freenet.de ...
I can live with that :-)
Any suggestions then on how to accomplish a splash screen in the main
form????
Thanks!
Derek

"Armin Zingler" <az*******@freenet.de> wrote in message
news:40***********************@news.freenet.de...
Derek Martin < DM ***** @ DONTSPAMMEokstate.edu> schrieb
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
你好,这可能真的很蠢,但我使用的是一个对话框作为我的主要表单,我的启动表单是我的启动画面 - 它实现了一些进度条加载一些相关数据。完成后,
加载表单执行此操作:

Me.Visible = False
mainform.ShowDialog()
Application.Exit()
<到目前为止这么好(这是一种愚蠢的做法吗?)。
IMO不是一个好主意。你应该只使用一个Form作为启动对象,如果
Hi there, this is probably really dumb, but I am using a dialog as my
main form and my startup form is my splash screen - which implements
some progress bars to load up some relevant data. When that is done,
loading form does this:

Me.Visible = False
mainform.ShowDialog()
Application.Exit()

So far so good (is this a dumb way of doing that???).
IMO not a good idea. You should only use a Form as the startup object if



从开始直到应用程序结束时,Form始终可见。


the Form will always be visible from the start til the end of the application.

[...]
问题在于:当我点击mainform上的ol最小化按钮时,
将应用程序控件传回加载,应用程序将退出,因为那是下一个线。我做错了什么/我可以调整什么以便在窗体最小化时控件不会重新加载?
[...]
Here is the problem: When I hit the ol minimize button on mainform,
the application control is passed back to loading and the application
exits since that is the next line. What am I doing wrong/what can I
adjust so that control doesn''t go back to loading when the form is
minimized??



ShowDialog可能表单最小化时退出。如果你改变了我上面写的那个,这个问题也应该已经解决了。

-
Armin

如何报价和原因:
http://www.plig.net/nnq/ nquote.html
http://www.netmeister .org / news / learn2quote.html



" Derek Martin" < DM ***** @ DONTSPAMMEokstate.edu> schrieb
"Derek Martin" <dm*****@DONTSPAMMEokstate.edu> schrieb
我可以忍受:-)
关于如何在
主窗体中完成启动画面的任何建议????
I can live with that :-)
Any suggestions then on how to accomplish a splash screen in the
main form????



/ In /主表格或在显示主表格之前?我假设后者:


共享sub main

dim splash as new splashform

dim main as mainform

splash.show

splash.refresh

main = new mainform

main.show

splash。关闭

application.run(主要)

结束分


我只回答了上面的问题 - 而不是NotifyIcon的问题。 ;-)


-

Armin


如何报价及原因:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



/In/ the main form or before showing the main form? I assume the latter:

shared sub main
dim splash as new splashform
dim main as mainform
splash.show
splash.refresh
main = new mainform
main.show
splash.close
application.run(main)
end sub

I only answered the question above - not the one with the NotifyIcon. ;-)

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


这篇关于对话框和通知图标的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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