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;
}
}
}
}
我怎樣才能改變我的代碼,所以當我回去的菜單組合框的狀態,因爲我離開它呢?