在Windows窗体之间交换 [英] Swapping between Windows forms

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

问题描述

我已经尝试过(几个小时)在谷歌搜索我的问题的答案,没有任何喜悦 - 我认为,我最大的问题是不知道要搜索哪些关键字。

我有也没有任何运气通过代码项目搜索(虽然我确定答案存在于某处)



我有一些程序,每个程序在菜单栏上都有一个帮助选项。单击此按钮时,将打开一个新的帮助窗口(显然显示帮助内容)

这很有效,除了用户必须阅读帮助内容,关闭帮助窗口和然后应用他/她读过的内容。



我想要达到的目的是:

用户单击父窗口上的帮助

程序打开另一个窗口(帮助窗口)

用户可以点击父窗口(即获得焦点)和帮助窗口''落后''父窗口

用户可以再次单击帮助窗口以获得焦点

,然后在两者之间翻转,直到完成帮助窗口并单击关闭按钮

如果用户执行了操作不关闭帮助窗口并关闭父窗口然后两者都应该关闭。



这可能吗?怎么样?



目前我正在使用VB2010(.Net Windows应用程序)并在帮助窗口中打开

I have tried (for hours now) searching on Google for the answer to my problem without any joy - My biggest problem, I think, is not knowing what keywords to search for.
I have also searched thru Code Project without any luck (though I am sure the answer resides there somewhere)

I have a few programs that each have a Help option on the Menu Bar. When this is clicked a new ''Help'' window is opened (that obviously shows the help content)
This works well, except that the user has to read the help content, close the Help window and then apply what he/she has read.

What I would like to achieve is :
User clicks Help on parent window
Program opens another window (Help window)
User is able to click on parent window (ie get focus) and Help window ''goes behind'' parent window
User can then click on Help window again to get focus
and so flip flop between the two until finished with Help window and clicks on Close button
If user does not close help window and closes parent window then both should be closed.

Is this possible? And how?

Currently I am using VB2010 (.Net Windows applications) and open with Help window with

frm_Help.ShowDialog()



然后在单击按钮时关闭帮助窗口


and then close the Help window when a button is clicked with

Me.Close()





任何帮助或指示将不胜感激。



Any assistance or pointers would be greatly appreciated.

推荐答案

尝试显示而不是ShowDialog - 它不会等待表单关闭然后继续。

您可能还想添加Form.TopMost = True,并可能添加一个FormClosing事件处理程序,以便在用户请求两次时只显示一个表单。
Try Show instead of ShowDialog - it doesn''t wait for the form to close before continuing.
You might want to add the Form.TopMost = True as well, and possibly add a FormClosing event handler so that you only show one form if the user requests it twice.


这篇关于在Windows窗体之间交换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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