Picture game trouble

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am making just a little game trying to learn picture box control but i am having lots of trouble with trying to figure out how when two picture poxes are activated (visible == false) a picture box under neath it canges images. So bacially i need to know
how to manage images through the code.?

heres my code, it may not be needed but whatever:

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; using System;
<span style="color:Blue; using System.Collections.Generic;
<span style="color:Blue; using System.ComponentModel;
<span style="color:Blue; using System.Data;
<span style="color:Blue; using System.Drawing;
<span style="color:Blue; using System.Linq;
<span style="color:Blue; using System.Text;
<span style="color:Blue; using System.Windows.Forms;

<span style="color:Blue; namespace Picture_game
{
<span style="color:Blue; public <span style="color:Blue; partial <span style="color:Blue; class Form1 : Form
{

<span style="color:Blue; int num1;


<span style="color:Blue; bool c1;
<span style="color:Blue; bool c2;
<span style="color:Blue; bool c3;
<span style="color:Blue; bool c4 = <span style="color:Blue; false;
<span style="color:Blue; bool c5;
<span style="color:Blue; bool c6;
<span style="color:Blue; bool c7;
<span style="color:Blue; bool c8;
<span style="color:Blue; bool c9;
<span style="color:Blue; bool c10;
<span style="color:Blue; bool c11;
<span style="color:Blue; bool c12;
<span style="color:Blue; bool c13;
<span style="color:Blue; bool c14;
<span style="color:Blue; bool c15;
<span style="color:Blue; bool c16;
<span style="color:Blue; bool c17;
<span style="color:Blue; bool c18;
<span style="color:Blue; bool c19 = <span style="color:Blue; false;
<span style="color:Blue; bool c20;

<span style="color:Blue; public Form1()
{
<span style="color:Blue; if (c4 == <span style="color:Blue; true && c19 == <span style="color:Blue; true)
{
PB4.Image = Properties.Resources.Check_icon;
}
InitializeComponent();
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox1_Click(<span style="color:Blue; object sender, EventArgs e)
{

num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox1.Visible = <span style="color:Blue; false;
}

}

<span style="color:Blue; private <span style="color:Blue; void pictureBox2_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox2.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox3_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox3.Visible = <span style="color:Blue; false;
}
}



<span style="color:Blue; private <span style="color:Blue; void pictureBox4_Click(<span style="color:Blue; object sender, EventArgs e)
{
c4 = <span style="color:Blue; true;
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox4.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox5_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox5.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox6_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox6.Visible = <span style="color:Blue; false;
}
}



<span style="color:Blue; private <span style="color:Blue; void pictureBox7_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox7.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox8_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox8.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox9_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox9.Visible = <span style="color:Blue; false;
}
}



<span style="color:Blue; private <span style="color:Blue; void pictureBox10_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox10.Visible = <span style="color:Blue; false;
}
}



<span style="color:Blue; private <span style="color:Blue; void pictureBox11_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox11.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox12_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox12.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox13_Click(<span style="color:Blue; object sender, EventArgs e)
{

num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox13.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox14_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox14.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox15_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox15.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox16_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox16.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox17_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox17.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox18_Click(<span style="color:Blue; object sender, EventArgs e)
{
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox18.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox19_Click(<span style="color:Blue; object sender, EventArgs e)
{
c19 = <span style="color:Blue; true;
num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox19.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void pictureBox20_Click(<span style="color:Blue; object sender, EventArgs e)
{

num1 += 1;
<span style="color:Blue; if (num1 <= 2)
{
pictureBox20.Visible = <span style="color:Blue; false;
}
}

<span style="color:Blue; private <span style="color:Blue; void button1_Click(<span style="color:Blue; object sender, EventArgs e)
{
pictureBox1.Visible = <span style="color:Blue; true;
pictureBox2.Visible = <span style="color:Blue; true;
pictureBox3.Visible = <span style="color:Blue; true;
pictureBox4.Visible = <span style="color:Blue; true;
pictureBox5.Visible = <span style="color:Blue; true;
pictureBox6.Visible = <span style="color:Blue; true;
pictureBox7.Visible = <span style="color:Blue; true;
pictureBox8.Visible = <span style="color:Blue; true;
pictureBox9.Visible = <span style="color:Blue; true;
pictureBox10.Visible = <span style="color:Blue; true;
pictureBox11.Visible = <span style="color:Blue; true;
pictureBox12.Visible = <span style="color:Blue; true;
pictureBox13.Visible = <span style="color:Blue; true;
pictureBox14.Visible = <span style="color:Blue; true;
pictureBox15.Visible = <span style="color:Blue; true;
pictureBox16.Visible = <span style="color:Blue; true;
pictureBox17.Visible = <span style="color:Blue; true;
pictureBox18.Visible = <span style="color:Blue; true;
pictureBox19.Visible = <span style="color:Blue; true;
pictureBox20.Visible = <span style="color:Blue; true;
num1 = 0;
}
}
}
[/code]
<br/>
<br/>


View the full article
 
Back
Top