Winform窗体中,假如我从Form1窗体要弹出Form2窗体,写法是这样的:
Form2 f2 = new Form2();
f2.Show();
1、如何使窗体打开时居中显示
//初始化默认窗体居中显示
Form2 f2 = new Form2();
f2.StartPosition = FormStartPosition.CenterScreen;
f2.Show();
2、如何实现弹出子窗口的不关闭时,其它的窗口无法操作
Form2 f2 = new Form2();
f2.StartPosition = FormStartPosition.CenterScreen;
f2.ShowDialog();
3、如何保证打开窗体是唯一的(是通过show()打开)
例子如下:
1、窗体页面
1)Form1页面
2)Form2页面
2、页面源码
1)Form1页面源码
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespaceTestWinForm
{public partial classFor