0
我所要做的就是更改form2上复选框的状态,并保持按下OK后的状态。 我有form1这是我的主要形式,它只有一个带菜单。 form1的代码如下:更改Form2上的复选框的状态并保持状态
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void dialogToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 dialog = new Form2();
dialog.ShowDialog();
}
}
}
Form2只有一个复选框和一个确定按钮。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace test
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void OK_Click(object sender, EventArgs e)
{
if (cbxForm2.Checked == true)
{
cbxForm2.Checked = true;
}
}
}
}
我怎样才能改变我的代码,所以当我回去的菜单组合框的状态,因为我离开它呢?