在同一窗口中打开一个新表单 [英] Opening a new form in same window

查看:105
本文介绍了在同一窗口中打开一个新表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我正在尝试构建包含几种不同形式的应用程序.当我单击一个按钮时,我想导航到另一个表单.我设法通过写以下内容来做到这一点:

Form1 form1 =新的Form1();
form1.Show();

但是,它在新窗口中打开,我希望在同一窗口中将其打开.有没有办法做到这一点?我还希望用户能够上传图片,然后可以通过button_click进入数据库.我对这两种应用程序的工作都还不够,只是通过网络编程.

祝一切顺利

Simon

Hello!

I''m trying to build an application concisting of several different forms. When I click on a button I want to navigate to another form. I manage to do this by writing:

Form1 form1 = new Form1();
form1.Show();

However, it opens in a new window and I want it to be opened in the same window. Is there a way to do this? I also want the user to be able to upload pictures which then is gonna go into a database, by a button_click, is this possible. I haven''t worked eith apps that much, just web-programming.

All the best

Simon

推荐答案

您是否正在使用WinForms?

如果是这样,您将无法在另一个表单中打开一个表单.但是,您可以创建UserControls 而不是Forms.然后在您的一个Form中,动态创建它们的实例,或者将它们全部放置在Form 上并设置其Visible 属性.

尼克
Are you using WinForms?

If so, you can''t open a form inside another form. You can, however, create UserControls instead of Forms. Then in your one Form, either create instances of them dynamically, or put them all on the Form and set their Visible properties.

Nick


这篇关于在同一窗口中打开一个新表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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