tsmolskow
asked on
.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?
ASKER
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.Resou rces.PushP in_Selecte d.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
toolStripButton4.Image = Prototype.Properties.Resou
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It's not working, here's my code:
private void toolStripButton4_Click(obj ect sender, EventArgs e)
{
if (toolStripButton4.Checked)
{
toolStripButton4.Image = Prototype.Properties.Resou rces.color _tab_enemy _selected;
}
else
{
toolStripButton4.Image = Prototype.Properties.Resou rces.color _tab_enemy _unselecte d;
}
}
Am I missing a setting on the control?
private void toolStripButton4_Click(obj
{
if (toolStripButton4.Checked)
{
toolStripButton4.Image = Prototype.Properties.Resou
}
else
{
toolStripButton4.Image = Prototype.Properties.Resou
}
}
Am I missing a setting on the control?
ASKER
OK, I found it, I had to set the CheckOnClick event to true - thanks again Nayer
myToolStrip.Items(index).I
_______________
Nayer Naguib