MDI:Windows窗体问题 [英] MDI: Windows Forms Question

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

问题描述

我将Window Form设置为与MDI类似的Panel Control,但是设置Window Form无法获得焦点是很重要的.

请教我如何在面板控件中设置焦点窗口窗体.
我无法按自己的工作特点使用MDI.

请帮帮我.


[原件.标题]
拜托,拜托,拜托.

I set Window Form to Panel Control similar with MDI but it has matter which been setting Window Form can''t get focus.

Please teach me how to set focus Window Form in Panel Control.
I can''t use MDI by character of my work.

Please help me.


[orig. title]
Please, Please, Please.

推荐答案

一些链接请参考:
使用C#引入MDI表单 [ http://www.geekpedia.com/tutorial41_Using-MDI.html [
Some links to refer:
Introduction to MDI Forms with C#[^]
http://www.geekpedia.com/tutorial41_Using-MDI.html[^]
And set focus with this code
foreach (Form frm in this.MdiChildren)
            {
                if (frm.Name == "form name to set focus")
                {
                    frm.Activate();
                    break;
                }
            }


非空表单不会获得焦点,它们会激活并进入前景.您可以呼叫Form.Activate().对于要获得焦点的控件,请只调用Focus().
Non-empty forms do not get focus, they activate and go to foreground. You can call Form.Activate(). For a control you want to get in focus -- only one, call Focus().


我认为您想将焦点设置为控件,但是它没有出现,对?如果是这样,请使用Select()方法,因为该控件位于另一个控件的内部,所以当您站在此控件的父控件之外时,Focus()方法将不适用于该控件.例如,
I think that you want to set focus to a control, but it''s not appear, right? If so, please use Select() method, because the control is inside of another control, the Focus() method cannot apply to control when you standing at outside the parent control of this control. E.g,
textBox1.Select();//This code can set focus for textbox control if this textbox is inside of a control container


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

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