0
내가하려는 것은 form2의 체크 상자 상태를 변경하고 프레스 후에 상태를 유지하는 것입니다. 저는 주 양식 인 form1을 가지고 있으며 하나의 Strip 메뉴 만 가지고 있습니다. 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;
}
}
}
}
내가 그것을 왼쪽으로 콤보 상자의 상태가 메뉴에 돌아갈 때 내가 그렇게 코드를 변경하려면 어떻게
? 당신이 열 값을 CheckBox
의 상태를 저장하고 할당 할 필요가 있으므로,
private void dialogToolStripMenuItem_Click(object sender, EventArgs e)
{
// the 'new' keyword means you are creating an entirely new instance
Form2 dialog = new Form2();
dialog.ShowDialog();
}
이 새로운 인스턴스가 이전 인스턴스가 어떻게 생겼는지 모르고있다 :