Change drop down menu location & size of menu item

3 posts, 0 answers
  1. Thi Han
    Thi Han avatar
    15 posts
    Member since:
    Oct 2011

    Posted 01 Oct 2012 Link to this post

    Hello Telerik


    I use application.I want to change drop down menu location & size of menu item. I want to display like "Pic1" image. But it is displaying like "Pic2" image. How can I change this?
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 04 Oct 2012 Link to this post

    Hi Thi Han,

    Thank you for contacting us.

    In the Application menu, the size of the second-level popup should be the same as the size of the second column. However, you can alter this behavior by handling the DropDownOpening event of your first-level menu items. The following sample demonstrates this:
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            foreach (RadMenuItem menuItem in this.radApplicationMenu1.Items)
            {
                menuItem.DropDownOpening += new CancelEventHandler(menuItem_DropDownOpening);
            }
        }
     
        void menuItem_DropDownOpening(object sender, CancelEventArgs e)
        {
            RadMenuItemBase menuItem = sender as RadMenuItemBase;
            if (menuItem != null)
            {
                RadPopupOpeningEventArgs eventArgs = (RadPopupOpeningEventArgs)e;
                eventArgs.CustomLocation = new System.Drawing.Point(eventArgs.CustomLocation.X,
                    menuItem.ControlBoundingRectangle.Y + this.radApplicationMenu1.DropDownButtonElement.DropDownMenu.Location.Y);
     
                menuItem.DropDown.MinimumSize = Size.Empty;
            }
        }
    }

    I hope this will help you. Feel free to ask if you have any additional questions.

    Regards,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Thi Han
    Thi Han avatar
    15 posts
    Member since:
    Oct 2011

    Posted 04 Oct 2012 Link to this post

    It well works . Thanks Telerik.
Back to Top