在winform C#弹出窗口 [英] Popup window in winform c#
问题描述
我工作的一个项目,我需要一个弹出窗口。但事情是我也希望能够添加文本框等在这个弹出窗口直通窗体设计器。
I'm working on a project where I need a popup window. But the thing is I also want to be able to add textboxes etc in this popup window thru the form designer.
所以基本上我有一个按钮,当你点击它它会打开我设计的窗体设计器的另一个窗口。
So basically I have a button and when you click on it it will open another window that I've designed in the form designer.
我已经做了一些谷歌搜索,但我还没有找到我需要的东西还没有,所以我希望你们能帮助我!
I've been doing some googling but I haven't found what I needed yet so I was hoping you guys could help me!
感谢
推荐答案
只要创建另一种形式(可以称之为 FormPopoup
)使用Visual Studio。在按钮处理程序编写代码followng:
Just create another form (lets call it FormPopoup
) using Visual studio. In button handler write followng code:
var form = new FormPopoup();
form.Show(this); // if you need non-modal window
如果您需要非模态窗口中使用的: form.Show();
。如果你需要对话框(所以您的代码将在这个调用挂起,直到关闭打开的表单)使用方法: form.ShowDialog()
If you need non-modal window use: form.Show();
. If you need dialog (so your code will hangs on this invocation until you close opened form) use: form.ShowDialog()
这篇关于在winform C#弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!