Hi Everyone,
I am building an application using ToolStripButtons as the main user interface.
I want to change the image displayed on a button when it is pressed. The idea is to show an 'Open' & 'Close' image.
I have the two image files registered in the Solution Explorer.
It all looks simple enough, but when I run my code, although the TEXT changes, the image doesn't.
Am I missing something
My code is:
private void tsbtnAcquireData_Click(object sender, EventArgs e){
if (AcquireFlag == false){
AcquireFlag =
true;tsbtnAcquireData.BackgroundImage = QuickView.Properties.
Resources.Close;tsbtnAcquireData.BackgroundImageLayout =
ImageLayout.None;tsbtnAcquireData.Text =
"Close";}
else{
tsbtnAcquireData.BackgroundImage = QuickView.Properties.
Resources.Open;tsbtnAcquireData.BackgroundImageLayout =
ImageLayout.None;tsbtnAcquireData.Text =
"Open";}
Many thanks for being out there.
John Woodiwiss
Live long , prosper and understand C#![]()

C# How do I change the Image on a ToolStripButton?
Dots
kubaw
Hi,
Sorry, this was an error in copying the code.
My code does include
AcquireFlag = false;
after the else statement.
John Woodiwiss
Live long , prosper and understand C#