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

9 posts, 0 answers
  1. Russell
    Russell avatar
    5 posts
    Member since:
    Apr 2009

    Posted 30 Mar 2011 Link to this post

    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
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 31 Mar 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Russell
    Russell avatar
    5 posts
    Member since:
    Apr 2009

    Posted 31 Mar 2011 Link to this post

    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
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 31 Mar 2011 Link to this post

    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
  6. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 05 Apr 2011 Link to this post

    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
  7. usman
    usman avatar
    34 posts
    Member since:
    Jun 2010

    Posted 30 Jun 2011 Link to this post

    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 
  8. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 05 Jul 2011 Link to this post

    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!

  9. Palanivelu
    Palanivelu avatar
    2 posts
    Member since:
    Mar 2012

    Posted 26 Mar 2012 Link to this post

    how can i set image height and width property???
    am waiting for your response


    Thanking you
    Palanivelu. S
  10. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 29 Mar 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready