CSharp Basic Function help.
Hi,
I am building/programming a freeware app in CSharp, and I am dealing with graphic "Click" functions.
I am using CSharp express 2008 (microsoft), and rather than create a "click" function for each graphic, I decided to make a function to call (this may actually slow it down, but it seems much easier to handle.).
right now there are about 4 of these -
Code:
private void pictureBox5_Click(object sender, EventArgs e)
{
if (pictureBox5.BackgroundImage != pictureBox33.Image)
{
pictureBox5.BackgroundImage = pictureBox33.Image;
}
else
{
pictureBox5.BackgroundImage = pictureBox29.Image;
}
}
What I did was write this -
Code:
public void Funky(System.Drawing.Image strParam)
{
if (strParam != pictureBox33.Image)
{ strParam = pictureBox33.Image; }
else
{ strParam = pictureBox29.Image; }
}
and call it like this -
Code:
private void pictureBox13_Click(object sender, EventArgs e)
{
Funky(pictureBox13.BackgroundImage);
}
What I'd like to have happen is to have the resource be changed out, but I am thinking I am identifying it wrong, or need to convert the variable. I am new to CSharp, but experienced in other languages. Any help appreciated!
Re: CSharp Basic Function help.
Need to Invalidate the main control to force a redraw
Re: CSharp Basic Function help.
Thank you much for the response.
Got it working great.