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

Change drop down menu location & size of menu item

2 Answers 130 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Thi Han
Top achievements
Rank 1
Thi Han asked on 01 Oct 2012, 08:57 AM
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 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 04 Oct 2012, 08:06 AM
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 >>
0
Thi Han
Top achievements
Rank 1
answered on 05 Oct 2012, 04:10 AM
It well works . Thanks Telerik.
Tags
Menu
Asked by
Thi Han
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Thi Han
Top achievements
Rank 1
Share this question
or