我希望在选择工具条后更改工具条上按钮的图像。图像属性是 system.drawing.bitmap 并保存到 Properties\Resources.resx 文件中。预先感谢
对逻辑的解释也很好!
我希望在选择工具条后更改工具条上按钮的图像。图像属性是 system.drawing.bitmap 并保存到 Properties\Resources.resx 文件中。预先感谢
对逻辑的解释也很好!
我发现有效的代码是:
toolStripButton.Image = Image.FromFile("directory of your file");
在按钮单击事件期间,只需调用此代码,图像就会改变
首先,您应该将 CheckOnClick 属性设置为 true,然后可以保存按钮的最后状态
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;
}
创建
ImageList imageList1;
并添加您需要的图像。
要更改toolStripButton image
您必须执行的操作:
toolStripButton1.Image = imageList1.Images[imageIndex];