This is a migrated thread and some comments may be shown as answers.

Can you set width/height for RadMenuItem image?!?

8 Answers 209 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Russell
Top achievements
Rank 1
Russell asked on 30 Mar 2011, 09:18 PM
Hi,

I've been trying to add images to items in an instance of the RadMenu, and it looks like you don't allow people to set the height or width of an image that is associated with an instance of RadMenuItem? Is there a way to do this, or do you actually have to create individual images, specially sized to 16x16 or whatever, for each of your menu items?

Thanks,

Russ

8 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 31 Mar 2011, 10:32 AM
Hello,

You shoud give the RadMenuItem the image sized at the size you wish to display it at. For exmaple
RadMenuItem item = new RadMenuItem();
item.Image = Properties.Resources.disks; // a 48x48 image
item.Text = "My Large Item";
item.AutoSize = true;
this.radMenuItem1.Items.Add(item);
Hope that helps
Richard
0
Russell
Top achievements
Rank 1
answered on 31 Mar 2011, 06:11 PM
Hi Richard,

Thanks for the informative response. I guess the right way to do this, from the documentation, is to use an ImageList on the menu, right? In the Infragistcs menu system, I can just specify an image and the dimensions - which is nice, because I can use the same image throughout the application, and just scale it. I can use a 256x256 image anywhere in the application, and just scale it down to 24x24 for the menu - if I had to create 65 images in three different sizes, just so I could use them in three different places throughout the application, that would be really painful...

So, i could just create an ImageList and scale that, right? Then assign that to the RadMenu and provide an index into the ImageList instance for each of the RadMenuItems, yes?

Thanks,

Russ
0
Richard Slade
Top achievements
Rank 2
answered on 31 Mar 2011, 09:38 PM
Hi Russell,

You can't just resize the ImageList as this recreates the handle. You would have to readd the add the images to the ImageList before resizing the images. See this MSDN article for more information

Regards,
Richard
0
Ivan Todorov
Telerik team
answered on 05 Apr 2011, 09:01 AM
Hello Russel,

Yes, using ImageList is the way to scale groups of images. ImageList is not a RadControl so more information about it can be found on the MSDN.

Basically, here are the steps you should follow in order to get this working:
  1. Drag an ImageList from the Toolbox.
  2. Add images to the list by editing its Images collection.
  3. On its Smart Tag or in the property grid: set the ImageSize property to 16,16.
  4. Select your RadMenu control and set its ImageList so that it points to the previously created ImageList.
  5. On each RadMenuItem: change its ImageIndex property to the index of the desired image in the list.

I hope you find this useful. Feel free to ask if you have any further questions.

Greetings,
Ivan Todorov
the Telerik team
0
usman
Top achievements
Rank 1
answered on 30 Jun 2011, 02:48 PM
i still cant understand , i just simple want the increase in height of the menu , currently its like 30px i want to make it 50px  with distortion of rollover and click 
0
Ivan Todorov
Telerik team
answered on 05 Jul 2011, 01:30 PM
Hello Usman,

I am not sure I fully understand your requirements. Which part of the menu you want to increase? Is it the RadMenu control, the drop-down menu or the menu items?

Basically, setting the MinSize property should do the this, but if you provide me with more details about your requirement, I will be able to provide you with more exact answer.

Additionally, could you also explain in more detail the desired behavior of the distortion on rollover and click? This will let me provide you with adequate support.

Looking forward to hearing from you.

Regards,
Ivan Todorov
the Telerik team

Register for the Q2 2011 What’s New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Palanivelu
Top achievements
Rank 1
answered on 26 Mar 2012, 04:53 PM
how can i set image height and width property???
am waiting for your response


Thanking you
Palanivelu. S
0
Ivan Petrov
Telerik team
answered on 29 Mar 2012, 08:29 AM
Hello Palanivelu,

Thank you for writing.

Can you please elaborate more on what you want to achieve. My colleague, Ivan Todorov, has given a step by step explanation on how to set the images size in the ImageList in his post from 5-April-2011. If you want to do something different, I would, again, ask you to provide some more details on your goal.

I am looking forward to you reply.

Regards,
Ivan Petrov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
Menu
Asked by
Russell
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Russell
Top achievements
Rank 1
Ivan Todorov
Telerik team
usman
Top achievements
Rank 1
Palanivelu
Top achievements
Rank 1
Ivan Petrov
Telerik team
Share this question
or