Example #1
0
        void menu_Popup(object sender, EventArgs e)
        {
            PopupMenuBarControl popupControl = (sender as PopupControl).IPopup as PopupMenuBarControl;

            popupControl.MouseMove += new MouseEventHandler(popupControl_MouseMove);
            (sender as PopupMenu).Manager.Form.BeginInvoke(new MethodInvoker(delegate {
                (sender as PopupMenu).ItemLinks[0].Focus();
            }));
        }
        protected override void CheckAndClosePopups(BarItemLink newLink)
        {
            BarPopupCollection  popups      = OpenedPopups;
            PopupMenuBarControl miniToolBar = popups.OfType <PopupMenuBarControl>().FirstOrDefault();

            if (miniToolBar != null)
            {
                return;
            }

            base.CheckAndClosePopups(newLink);
        }
Example #3
0
        void PMenu_Popup(object sender, EventArgs e)
        {
            FieldInfo           fi = typeof(PopupMenu).GetField("subControl", BindingFlags.Instance | BindingFlags.NonPublic);
            PopupMenuBarControl p  = (PopupMenuBarControl)fi.GetValue(sender);
            Point m = Control.MousePosition;
            int   x = m.X;
            int   y = m.Y;

            if (x + p.Form.Size.Width > Screen.PrimaryScreen.Bounds.Width)
            {
                x = x - p.Form.Size.Width;
            }
            if (y + p.Form.Size.Height > Screen.PrimaryScreen.Bounds.Height)
            {
                y = y - p.Form.Size.Height;
            }
            _popupRect = new Rectangle(new Point(x, y), p.Form.Size);
        }