I am looking to change the image of the button on the tool strip after it is selected. The image property is system.drawing.bitmap and was saved to Properties\Resources.resx file. Thanks in advancen
An explanation of the logic would be nice too!
I am looking to change the image of the button on the tool strip after it is selected. The image property is system.drawing.bitmap and was saved to Properties\Resources.resx file. Thanks in advancen
An explanation of the logic would be nice too!
First, you should set the CheckOnClick property to true then, it is possible to save the last status of button
this.toolStripMuteButton.CheckOnClick = true;
if (toolStripMuteButton.Checked)
{
this._lastMicVol = tag.Volume;
this.toolStripMuteButton.Image = lobal::Properties.Resources.microphone2;
tag.Volume = 0;
}
else
{
this.toolStripMuteButton.Image = global::Properties.Resources.microphone1;
tag.Volume = this._lastMicVol;
}
The code I found that works is:
toolStripButton.Image = Image.FromFile("directory of your file");
During a button click event, just call this code, and the image will change