子窗体:不允许子窗体移出MainForm. [英] SubForm: Don't Allow SubForm move out of MainForm.
本文介绍了子窗体:不允许子窗体移出MainForm.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我做了一个DataGrid问题,它们工作得很完美,所以我认为这是解决我问题的最佳场所.
好吧,就像标题说的那样.我不想允许用户可以将子窗体移出MainForm Windows.
我也可以冻结表单,因为不允许用户移动?
谢谢. ;)
Hi, I do a Question of DataGrid and They Work All perfect, So I think that here is the best place to do my question.
Well, Like the title say. I dont want to Allow that a User can Move a subform out of MainForm Windows.
Also I posible to Freeze the Form for don''t allow user to move?
Thanks. ;)
推荐答案
好吧,它可以通过2种方式完成
首先,获取子窗体的LocationChanged事件,不要让它超出主窗体的范围.
其次,将Panel添加到您的主窗体中,然后在其中添加子窗体,但是必须将子窗体的TopLevel
属性设置为false.
像这样的东西
well, it can be done in 2 ways
first, grab LocationChanged event of subform and dont let it go outside the main form''s bounds.
second, add a Panel to your main form and add the subform in it but to do that you must set sub form''sTopLevel
property to false.
something like this
subform.TopLevel = false;
subform.Show();
panel1.Controls.Add(subform);
现在,我阅读了更多的书,发现了Mdi.
Now I read more and I found Mdi.
这篇关于子窗体:不允许子窗体移出MainForm.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文