我想知道您是否可以向我提供有关以下内容的信息。我有两种形式 - 形式A和形式B.在形式A中,我必须选择两个团队,每个团队使用两个组合框。当我点击“继续”这是一个按钮时 - 我希望能够使用在FormA的表格B中的Combox中选择的任何团队...我可以给你以下代码,告诉你我尝试了但是它不起作用。 ..对此事的任何协助将不胜感激。 :)
internal ComboBox cBox1 = new ComboBox();
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//WHEN CHOOSING A TEAM THEIR FLAG WILL APPEAR IN THE PANEL
if (comboBox1.SelectedIndex != comboBox2.SelectedIndex)
{
Graphics gR = panel1.CreateGraphics();
comboBox1.SelectedItem = cBox1;
if (cBox1.ToString() == "New Zealand")
{
//DRAW NEW ZEALAND RUGBY LOGO
Image imag = Image.FromFile("NZ.jpg");
gR.DrawImage(imag, new Point(0, 0));
label6.Text = "No. 1";
//listOfTeams.Add(NZ);
}
}
internal PlayerList SCList = new PlayerList();
int total = 0;
int tryScored = 5;
int penOrDropkick = 3;
int conversionTry = 2;
public int seconds;
public int minutes;
public int hours;
public FormB()
{
InitializeComponent();
}
//LOADING THE FORM
private void FormB_Load(object sender, EventArgs e)
{
FormA f = new FormA();
Graphics gR = panel1.CreateGraphics();
//IF THE COMBOBOX IN FORM A WAS INDEED "New Zealand" THEN IT WILL DRAW THE FLAG IN THE PANEL
if(f.cBox1.ToString() == "New Zealand")
{
Image imag = Image.FromFile("NZ.jpg");
gR.DrawImage(imag, new Point(0, 0));
}
}