本文介绍了Winform的模板系统就像母版ASP.NET或MS访问子窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

难道一个WinForm的框架类似于ASP.NET或母版的MS Access子窗体?

Does a Winform Framework exist for something similar to ASP.NET Masterpage or MS Access SubForm ?

使用的MS Access子窗体的东西,你可以像ASP.NET母版存在。它是时间的Winform不必创建了很多复杂的表单时,一个巨大的损失。您有任何代码生成,营造代码重复或进行运行时动态形式更加难以补偿。

With MS Access SubForm you can do like ASP.NET Masterpage. It's a huge loss of time with Winform when having to create a lot of complex form. You have to compensate with either Code Generation which create code duplication or do Runtime Dynamic Form which is much more difficult.

我在互联网上搜索,但找不到任何。

I searched on the Internet but can't find any.

推荐答案

您可以形式添加到表单,或窗体上的面板。

You can add forms to a form, or to a panel on a form.

public Form1()
{
    InitializeComponent();

    Form2 embeddedForm = new Form2();
    embeddedForm.TopLevel = false;
    Controls.Add(embeddedForm);
    embeddedForm.Show();
}

您将需要设置 FormBorderStyle ,除非你想有你的窗体中实际可移动的形式。

You will need to set the FormBorderStyle to None, unless you want to have an actual moveable form inside your form.

我是在一个位在发布的时间匆忙,但是亨克是正确的。您应该考虑创建此用户控件来代替。不要与自定义的控制,其目的是当你需要做自己的绘图,而不是使用标准Windows控件集合的混淆。

I was in a bit of a hurry at the time of posting, but Henk is right. You should consider creating a user control for this instead. Not to be confused with a custom control, which is intended for when you need to do your own drawing instead of using collections of standard Windows controls.

这篇关于Winform的模板系统就像母版ASP.NET或MS访问子窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 07:05