I’ve got a button in my WinForms plugin. It’s got an image on it. The thing is, when I click the button, I want the image to change from whatever image it is now, to whatever image I want it to be.
So basically how do i make button change its image? The image type is System.Drawing.Image.
In order to change a
Button‘s image in WinForms you set it’sImageproperty. You can either load a bitmap from a file withBitmap.FromFile, or you can draw an image using theGraphicclass by creating a new instance of Bitmap using the Width/Height constructor (i.e.new Bitmap(100, 100)) and then use theGraphic.FromImagemethod. Lookup the documentation on theGraphicclass for more info.