how can I get a bool from class2 in Form2 to class1 in form1?
I've tried calling the variables, but that wasn't a success. Or i did something wrong
Class Form3UpgradesGunSounds:
// If you double click, it will select the sounds
private void Form3UpgradesGunSounds_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (e.X > 36 && e.X < 336 && e.Y > 35 && e.Y < 93) // FireTankCannon100
{
_tankCannon100 = true;
}
else if (e.X > 336 && e.X < 670 && e.Y > 35 && e.Y < 93) // FireTankCannon120
{
_tankCannon120 = true;
}
this.Close();
}
public bool GetTankCannon100()
{
return _tankCannon100;
}
public bool GetTankCannon120()
{
return _tankCannon120;
}
Class Form1Game:
public void MoleShooter_MouseClick(object sender, MouseEventArgs e)
{
// ...
Form3UpgradesGunSounds fr3UpgradesSounds = new Form3UpgradesGunSounds();
bool _f1tankCannon100 = fr3UpgradesSounds.GetTankCannon100();
bool _f1tankCannon120 = fr3UpgradesSounds.GetTankCannon120();
if (_f1tankCannon100 == false)
{
F1TankCannon100();
}
else if (_f1tankCannon120 == true)
{
F1TankCannon120();
}
// ...
}
public void F1TankCannon100() { /*. Do something .*/ }
public void F1TankCannon120() { /*. Do something .*/ }
My question is How I can create and access to properties in Form3UpgradesGunSounds
from the form Form1Game
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…