Computer Science Canada

pics on buttons?

Author:  william 01 [ Tue Apr 19, 2011 1:01 pm ]
Post subject:  pics on buttons?

does any one know if its possible to put an image on a button, if so how?

Author:  z_cross_fire [ Tue Apr 19, 2011 7:45 pm ]
Post subject:  RE:pics on buttons?

Yes. Use the 'Image' property of the button.

Author:  william 01 [ Thu Apr 21, 2011 12:52 pm ]
Post subject:  Re: pics on buttons?

can you post an example?

Author:  z_cross_fire [ Fri Apr 22, 2011 11:37 pm ]
Post subject:  Re: pics on buttons?

Make a button;

Posted Image, might have been reduced in size. Click Image to view fullscreen.

Use its Image property;

Posted Image, might have been reduced in size. Click Image to view fullscreen.

And finally import an image, and click OK.
Posted Image, might have been reduced in size. Click Image to view fullscreen.

You can also use the "BackgroundImage" property for the button instead. You then have a choice to change the layout ("BackgroundImageLayout" property) for the background image ("StretchImage" works fine).

You might want to give this a read, if you prefer changing the image from code:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage.aspx

or this,
http://msdn.microsoft.com/en-us/library/system.windows.forms.buttonbase.image.aspx

Good Luck,
Z

Author:  william 01 [ Tue Apr 26, 2011 12:34 pm ]
Post subject:  Re: pics on buttons?

ok Smile but, im trying to create a chess/checkers game so in need to be able to shift the images around, what i should have asked is if that is possable Doh!




btw Exclamation i am using 2008 so some of the stuff u can do i might not to be able to

Author:  Insectoid [ Tue Apr 26, 2011 1:38 pm ]
Post subject:  RE:pics on buttons?

You should be able to do something along the lines of 'button1.image = some_image'. I dunno the specifics, but that's the idea. Check z_cross_fire's links.


: