新建一个项目,添加Form2。
设置如下属性:
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
添加如下两个按钮
将画面属性中两个属性做如下设置:
this.AcceptButton = this.button1;
this.CancelButton = this.button2;
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace WindowsFormsApplication23 {
{
{ InitializeComponent(); }
{
}
{
} } } |
Form2做如下设置
using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace WindowsFormsApplication23 {
{
{ InitializeComponent(); }
{
{
}
{
} f2.Dispose(); } } } |