I have items that are added to a dropdown menu, upon selecting one of the items, the main button changes to that items image. However once changed, the images vary in size, when they should be holding a size of 24, 24. Is there a way to set the button properties so that even if the image is set to a larger image, it will hold the size to 24, 24 ?
foreach (IEffectModuleDescriptor effectDesriptor in ApplicationServices.GetModuleDescriptors<IEffectModuleInstance>().Cast<IEffectModuleDescriptor>())
{
ToolStripMenuItem menuItem = new ToolStripMenuItem(effectDesriptor.EffectName);
menuItem.Tag = effectDesriptor.TypeId;
menuItem.Text = effectDesriptor.EffectName;
menuItem.Image = effectDesriptor.GetRepresentativeImage(24, 24);
menuItem.Click += (mySender, myE) =>
{
toolStripDropDownDrawMode.Image = menuItem.Image;
};
toolStripDropDownDrawMode.DropDown.Items.Add(menuItem);
}
I Solved this by creating a new bitmap of my image as follows, for others who may encounter this issue.
menuItem.Image = new Bitmap(effectDesriptor.GetRepresentativeImage(24, 24), new Size(24,24));