Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
459
Getting Popup Menu Size
posted

Is there anyway to determine the size of a popup menu?  I'm specifically looking for the Height of the popup men.

 What I'm trying to do is show a popup menu when a user clicks a button - but I want the popup men to appear above the button: left aligned to the button and then the bottom of the popup menu ending at the top of the button.

I can get the coordinates of the top left point of the button to show the popup menu but I can't seem to acquire the Height of the popup menu to subtract from the button top location to achieve the location I'm looking for.

I'm using the ShowPopup() method that takes a Point parameter.

I'm trying to mimic the behavior of the UltraDropDownButton but since that control can't be made to look like an UltraButton (with OS themes turned on) and it only shows the popup menu below the UltraDropDownButton, I'm having to 'roll my own'.

Any help sincerely appreciated.

Thanks,

-David

  • 44743
    Verified Answer
    posted

    Thee is no way to calculate the size of the popup and position it before it shows, but you can position the popup the way you want with another overload of ShowPopup:

    Point buttonScreenLocation = this.ultraButton1.PointToScreen( Point.Empty );
    Rectangle exclusionRect = new Rectangle( buttonScreenLocation, this.ultraButton1.Size );
    this.ultraToolbarsManager1.ShowPopup(
     "PopupMenuTool1",
     buttonScreenLocation,
     this.ultraButton1,
     exclusionRect,
     DropDownPosition.AboveExclusionRect );