tags:

views:

39

answers:

1

Hello Everyone,

I have a ContextMenuStrip with two MenuItems on it. I would like to display an image on one of those items but when I do this, the other item resizes to the image scaling size of the MenuStrip, even though it does not have an image itself. Is there a way around this to just resize the item that has an image without affecting the others?

Update: First I've tried setting ImageScaling property of the MenuItem I didn't want resized to None. This had no effect and neither did playing around with the AutoSize or SizeMode properties.

I've had some success by using the BackgroundImage property instead of the Image property of the MenuItem and just manually setting the size of the MenuItem to be displayed. But I can't get the text to appear at the bottom of the MenuItem, even though I've set the TextAlign property to BottomCenter. Plus, using the BackgroundImage property seems like a work-around rather than a good solution.

A: 

Set ImageScaling to SizeToFit (the default) for the ToolStripMenuItem that has the image.

Adel Hazzah
The problem is that I want the image shown to be a different size (100x100), so I set the ImageScalingSize property to 100,100 and the other items on the menu strip resize to those dimensions even though they have no image set. I would like to keep them normal size while resizing the one menu item.
I used Reflector to look at how the ToolStrip performs layout. It seems that it uses the largest size of all the ToolStrip items, so it looks like you are out of luck.
Adel Hazzah