SetPosition() приватный Метод

Position the menu relativly to a parent menu
private SetPosition ( Rectangle rect, bool reverseX, bool reverseY ) : void
rect System.Drawing.Rectangle
reverseX bool
reverseY bool
Результат void
Пример #1
0
        /// <summary>
        /// an item has been pressed
        /// </summary>
        private void OnItemPressed()
        {
            var item = _content[_selectedIndex];

            // item has children, open a new menu
            if (item.Children != null && item.Children.Any())
            {
                _childMenu = new YamuiMenu(Location, item.Children)
                {
                    IamMain     = false,
                    _parentMenu = this
                };
                _childMenu.SetPosition(new Rectangle(Location.X + Width, Location.Y + Controls[_selectedIndex].Top, Width, Height), _reverseX, _reverseY);
                _childMenu.Show();
            }
            else
            {
                // exec action and close the menu
                item.Do();
                CloseAll();
            }
        }
Пример #2
0
 /// <summary>
 /// an item has been pressed
 /// </summary>
 private void OnItemPressed()
 {
     var item = _content[_selectedIndex];
     // item has children, open a new menu
     if (item.Children != null && item.Children.Any()) {
         _childMenu = new YamuiMenu(Location, item.Children) {
             IamMain = false,
             _parentMenu = this
         };
         _childMenu.SetPosition(new Rectangle(Location.X + Width, Location.Y + Controls[_selectedIndex].Top, Width, Height), _reverseX, _reverseY);
         _childMenu.Show();
     } else {
         // exec action and close the menu
         item.Do();
         CloseAll();
     }
 }