形式焦点问题 [英] Form Focus Issue

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

问题描述

首先,我在Visual Studio中使用.NET 2.0框架

2005.


我有两种形式。一个是带有TreeView控件的表单(用作

a菜单 - 一个收藏列表),另一个是带有

WebBrowser控件的表单。 br />

TreeView_Click事件触发另一个表单,链接通过节点传递给它b / b
。如果用户单击TreeView并且表单已经打开并且其中包含该链接,则应将焦点设置为

相应表单。确实会发生这种情况,但看来当Click

事件完成时,带有TreeView控件的表单会重新获得

焦点。除了TreeView表单之外,正确的WebBrowser表单

位于前面。


如何使用TreeView获取表单以保持正确

选择WebBrowser表格?


任何建议都会受到赞赏。


Mark Dahl

First of all, I am using the .NET 2.0 framework with Visual Studio
2005.

I have two forms. One is a form with a TreeView control on it (used as
a menu - kindof a favorites list) and the other is a form with a
WebBrowser control on it.

The TreeView_Click event fires up the other form with the link passed
to it via the Node. If the user clicks the TreeView and the form is
already open with that link in it, it is supposed to set focus to the
appropriate form. This does occur, but it appears that when the Click
event completes, the form with the TreeView control on it gets the
focus back. So other than the TreeView form, the proper WebBrowser form
is at the front.

How do I get the form with the TreeView to remain behind the properly
selected WebBrowser form?

Any suggestions would be appreciated.

Mark Dahl

推荐答案

不仅仅是me.sendtoback?表格继承自控制,所以这应该有效。


tm

Fr15ky < SH ******** @ gmail.com>在消息中写道

news:11 ********************** @ f14g2000cwb.googlegr oups.com ...
isn''t it just me.sendtoback? form inherits from control so this should work.

tm
"Fr15ky" <sh********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
首先,我在Visual Studio中使用.NET 2.0框架
2005.

我有两种形式。一个是带有TreeView控件的表单(用作菜单 - 一个收藏夹列表),另一个是带有
WebBrowser控件的表单。

TreeView_Click事件触发另一个表单,其中链接通过Node传递给它。如果用户单击TreeView并且表单已经打开并且其中包含该链接,则应将焦点设置为相应的表单。确实会发生这种情况,但看起来当Click
事件完成时,带有TreeView控件的表单会重新获得
焦点。除了TreeView表单之外,正确的WebBrowser表单位于前面。

如何使用TreeView将表单保留在正确选择的WebBrowser表单后面?

任何建议都将不胜感激。

Mark Dahl
First of all, I am using the .NET 2.0 framework with Visual Studio
2005.

I have two forms. One is a form with a TreeView control on it (used as
a menu - kindof a favorites list) and the other is a form with a
WebBrowser control on it.

The TreeView_Click event fires up the other form with the link passed
to it via the Node. If the user clicks the TreeView and the form is
already open with that link in it, it is supposed to set focus to the
appropriate form. This does occur, but it appears that when the Click
event completes, the form with the TreeView control on it gets the
focus back. So other than the TreeView form, the proper WebBrowser form
is at the front.

How do I get the form with the TreeView to remain behind the properly
selected WebBrowser form?

Any suggestions would be appreciated.

Mark Dahl



Fr15ky,


我不知道你已经在VBNet上工作了多长时间。


安静,但是在网络中,当你改变一个项目时,这是合乎逻辑的/>
事件,它可能触发自己或其他事件。 (这个

尤其适用于组合框,列表框和树视图)


这可以改变行为。你确定它不是那样吗。


我希望这会有所帮助,


Cor
Fr15ky,

I am not aware how long you are working already with VBNet.

Quiet anoying however logical is that in Net, when you change an item in an
event, it is possible that it triggers its own or another event. (This
happens especially with the combobox, listbox and treeview)

That can change the behaviour. Are you sure that it is not that.

I hope this helps,

Cor

Toff,


我会尝试这样做,我能够让它第一次工作

点击链接做一个WebBrowserForm .BringToFront,
WebBrowserForm.Activate和WebBrowser中的WebBrowserForm.Focus

控制_Navigated事件。但是一旦表单被加载,这个

事件就不再运行,因为我只是设置焦点(激活,将

带到前面)相应的WebBrowserForm。在我的快速试用中,

然而,这不起作用(或者我没有找到最后一个事件是

导致导航器表单重新获得焦点。 />

Cor,


老实说,我是.NET新手。我只是真的在.NET上工作

大约2周。这显然是面向事件的,因为这个问题是特定于MouseDown事件的
但是TreeView的KeyDown事件

正常工作。


你有一个你认为适合Toff的

建议的活动吗?我更喜欢一个可以绑在TreeView上的活动。


感谢您的回复和帮助。


Mark Dahl

Toff,

I will try doing that, I was able to have it work the first time I
click the link by doing a WebBrowserForm.BringToFront,
WebBrowserForm.Activate, and WebBrowserForm.Focus in the WebBrowser
controls _Navigated Event. But once the form has been loaded, this
event no longer runs as I am just setting focus (activating, bringing
to the front) the appropriate WebBrowserForm. In my quick trial,
however, this did not work (or I am not finding the last event that is
causing the Navigator form to get the focus back.

Cor,

Honestly, I am new to .NET. I have only really been working on .NET for
about 2 weeks. It is obviously event oriented, because this problem is
specific to the MouseDown event but the KeyDown event of the TreeView
works properly.

Do you have an event that you believe would work properly for Toff''s
suggestion? I would prefer an event that can be tied to the TreeView.

Thanks for the responses and the help.

Mark Dahl


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

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