没有新标签没有新窗口 [英] No new tab no new Window

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

问题描述

我正在使用Visual Studio 2008,突然间我陷入了困境。我正在研究WindowsApplicationForm,所以在这里我做了第一页,我写了欢迎这个和小设计并插入按钮,我写了''点击继续''现在我想要当我点击它我必须移至下一页但不在单独的窗口或标签或表单中。我希望以这种特定的形式打开。



我希望你得到我的观点,如果不是再有一个例子,当我们建立任何链接然后将其属性设置为打开在父或自我这样。

I am using Visual Studio 2008 and sudden I stuck in one thing. I am working on WindowsApplicationForm so in this I made first page on which I wrote welcome to this this and little design and insert on button on which I wrote ''Click to proceed'' now I want that when I click on it I have to move to next page but not in separate window or tab or form. I want to open in that specific form.

I hope you got my point if not then one more example that when we make any link and then set its property to open in parent or self like this.

推荐答案

有很多不同的方法可以做到这一点,但最简单的方法可能是创建一些UserControls。这些是类似表单的对象,您可以在设计器中添加控件和代码,以便它们独立于显示它们的表单 - 您只需要处理主窗体上的按钮并隐藏它们当前的UserControl(通过将其Visible属性设置为false)并显示新信息(通过将其Visible属性设置为true)。



所以你会创建一个欢迎 UserControl有你的欢迎这个消息,以及一个单独的工作UserControl,它有一堆不同的控件和处理。然后主要形式变得非常简单:两个UserControl在同一个地方,一个最初是Visible而另一个不是,一个按钮改变了可见性。



所有实际工作发生在UserControls中,因此主窗体不必担心它。
There are quite a few different ways to do that, but the simplest to work with is probably to create a number of UserControls. These are little "form-like-objects" that you can add controls and code to in the designer so that they are independant of the form on which they are shown - all you have to do is handle the button on your main form and hide the current UserControl (by setting its Visible property to false) and reveal the new information (by setting its Visible property to true).

So you would create a "welcome" UserControl that had your "welcome to this" message, and a separate "working" UserControl that had a different bunch of controls and processing. The main form then becomes really simple: two UserControls in the same place, one initially Visible and one not, and a button which changed the visibility.

All the actual work happens in the UserControls so the main form doesn''t have to worry about it.


如果你想在Form中实现类似页面的东西,我会建议最简单但最健壮的实现:设计几个面板,每个页面一个,加上一个带按钮的面板。使用 System.Windows.Forms.DockStyle.Bottom 将按钮停靠在面板上,然后使用顶部的空白区域打开所有页面面板的Panel父级,将它与 System.Windows.Forms.DockStyle.Fill 对接。将所有页面窗体停靠在其父窗体中,并将​​它们停靠在填充样式中。然后全部不是可见,除了第一个。



(如果你想添加主菜单和状态栏,一开始就做。)



现在,从一页到另一页的步行将通过隐藏除一个以外的所有面板来完成。您只需更改可见性,选择一个面板即可。







其他一些想法,请查看我对解决方案2的评论中引用的过去答案。



-SA
If you want to implement something like pages in the Form, I would advice the simplest yet robust implementation: design several Panels, one per "page", plus a Panel with buttons. Dock the panel with buttons using System.Windows.Forms.DockStyle.Bottom, and then use the open space on top to open a Panel parent to all your "page" Panels, dock it with System.Windows.Forms.DockStyle.Fill. Dock all page forms in its parent and dock them in the "Fill" style. Make then all not Visible, except the first one.

(If you want to add the main Menu and Status Bar, do it in the very beginning.)

Now, walking from page to page would be done by hiding all panels except one. You simply change the visibility, selecting one panel to be made visible.



For some other ideas, please check out my past answers referenced in my comment to Solution 2.

—SA

我猜您正在接受MDI表格。



请参阅以下链接以了解如何操作。

1 。如何在C#中的同一窗口中打开新的表单窗口? [ ^ ]。

I guess you are taking about the MDI forms.

Refer the below links to know how to do it.
1. How to open a new form window within same window in C#?[^].
引用:

你的表格(窗口)必须是MDI



Your Form(Window) must be MDI

YourForm.IsMdiContainer = True

NewForm.MdiParent = YourForm;
NewForm.Show();






2. 如何在C#2008中的另一个表单中加载表单? [ ^ ]。

3. 使用C#创建MDI应用程序(演练) [ ^ ]。

4. 用C#开发MDI应用程序 [ ^ ]。


2. How to load a form inside another form in C# 2008?[^].
3. Creating MDI application using C# (Walkthrough)[^].
4. Developing MDI Applications in C#[^].


这篇关于没有新标签没有新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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