Using pictures on buttons

Adrammelech

Member
Joined
Mar 9, 2007
Messages
11
Programming Experience
Beginner
I was making a very simple game for a friends site(tic-tac-toe) and I'm trying to get it where X = Pic1 and O = Pic2 but I dont know if you can use pictures for that. Would the easiest way to do this to change the buttons to pictureboxes or is there some way to use pictures on buttons?
 
I think you can put something like:
Button1.Image = System.Drawing.Image.FromFile("C:\Images\Pic1.Gif")
in your button click event. Then, when clicked, button1 should show Pic1.
Of course you have to have the correct path to your picture file.
You can shorten up the code some by referencing System.Drawing, instead of having to type it in for each button.

Should work.

Good Luck
 
Back
Top