在父窗体中打开一个窗体 - 在 c# 中不是作为单独的屏幕 [英] Open a form within the parent form-Not as separate screen in c#

查看:22
本文介绍了在父窗体中打开一个窗体 - 在 c# 中不是作为单独的屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有按钮的父表单,当我想在按钮的点击事件中打开一个新表单时.

I have a parent form with a button and when in the click event of the button I want to open a new form.

Form2 form2= new Form2();
form2.Show();

但是,form2 是作为一个单独的进程打开的.我希望表单在父表单中打开.

But, form2 is opened as a separate process. I want the form to opened inside the parent form.

在谷歌搜索时,我发现 MDI 已被弃用.那么你能给我推荐一个好方法吗?

While googled I found out that MDI is being deprecated. So could you please suggest me a good way?

推荐答案

在谷歌搜索时,我发现 MDI 已被弃用

While googled I found out that MDI is being deprecated

这就像马克吐温的名言:关于我死亡的报道被大大夸大了".MDI 内置于 Windows 中,许多旧程序都依赖于它.它已经存在超过 25 年,并且不会很快消失.

This is like Mark Twain's famous quote: "The reports of my death have been greatly exaggerated". MDI is built into Windows, many old programs depend on it. It has been around for over 25 years and is not going away anytime soon.

当程序员不喜欢某个功能时,他们喜欢随意宣布已弃用的内容.当然,没有人对 MDI 如此着迷.WPF 没有实现它并不会让它被弃用,这会使 shell 通知图标也被弃用,而且它们肯定还活着.MDI 是一种窗口模型,它是为了处理 25 年前用户拥有的那种监视器而发明的.640 x 480 显示器不会为窗户留下太多空间.寻找使重叠窗口易于管理的方法是其主要目标.

Programmers like to arbitrarily announce something deprecated when they don't like a feature. Sure, nobody is that smitten with MDI. That WPF didn't implement it doesn't make it deprecated, that would make shell notify icons deprecated too and they certainly are alive and well. MDI was a windowing model that was invented to deal with the kind of monitors users had 25 years ago. And 640 x 480 displays don't leave a lot of room for windows. Finding a way to make overlapping windows manageable was its primary goal.

仍然在我们今天拥有的巨大显示器上使用它没有多大意义.停靠布局更明智.Visual Studio 就是一个很好的例子.如果您不想自己创建一个库,则需要去购买支持它的库.Weifenluo 的 DockPanelSuite 很受欢迎,而且价格也很合适.

It doesn't make much sense to still use it on the gigantic monitors we have today. Docking layouts are much more sensible. Visual Studio being a good example. You'll need to go shopping for a library that support it if you don't want to create one yourself. Weifenluo's DockPanelSuite is very popular and has the right price.

这篇关于在父窗体中打开一个窗体 - 在 c# 中不是作为单独的屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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