.NET 2.0 with toolstrip

I'm using .NET 2.0 with a tooltsrtip in a form.  I have added a button to the tool strip, and I used the image property to assign a image to the button.  Now I want to create a pressed in pushed out effect with two different images.  My question is, how do I dynamically change the image associated with the button on the toolstrip?
tsmolskowAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nayernaguibCommented:
Use the following statement:

            myToolStrip.Items(index).Image = System.Drawing.Image.FromFile("filePath") 'or any other image source

_______________

  Nayer Naguib
tsmolskowAuthor Commented:
Right, I guess I didn't write my question well, I wanted the flow logic code to be able to switch back and forth between images, right now I'm using a resource file and this code to change images:

toolStripButton4.Image = Prototype.Properties.Resources.PushPin_Selected.png;

But i'm not sure of the logic I need to switch the pin images from selected to unselected and back based on the click event
nayernaguibCommented:
This depends on whether you would like to display a different image *while* the button is being clicked, or you would like to change the image with every click (change the state of the button until it is pressed again).

To change the image everytime the button is checked/unchecked, you should set the CheckOnClick property of the button to true, and add the following code to the Click event handler of the *button* (not the ToolStrip):

            if (myToolStripButton.Checked)
                myToolStripButton.Image = someImage;
            else
                myToolStripButton.Image = theOtherImage;

If you want to change the image *while* the button is being pressed, then I'll need to give it a try and come back to you. :-)

_______________

  Nayer Naguib

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tsmolskowAuthor Commented:
It's not working, here's my code:

     private void toolStripButton4_Click(object sender, EventArgs e)
     {
 
            if (toolStripButton4.Checked)
            {
                toolStripButton4.Image = Prototype.Properties.Resources.color_tab_enemy_selected;
            }
            else
            {
                toolStripButton4.Image = Prototype.Properties.Resources.color_tab_enemy_unselected;
            }
     }


   Am I missing a setting on the control?
tsmolskowAuthor Commented:
OK, I found it, I had to set the CheckOnClick event to true - thanks again Nayer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.