Details for a close button action event.
Inheritance: KryptonPageCancelEventArgs
        /// <summary>
        /// Processes the RightClick event from the button.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">An EventArgs containing the event data.</param>
        protected virtual void OnRightClick(object sender, MouseEventArgs e)
        {
            // Can only select the page if not already selected and allowed to select a tab
            if ((_navigator.SelectedPage != _page) && _navigator.AllowTabSelect)
            {
                _navigator.SelectedPage = _page;
            }

            // Generate event so user can decide what, if any, context menu to show
            ShowContextMenuArgs scma = new ShowContextMenuArgs(_page, _navigator.Pages.IndexOf(_page));

            _navigator.OnShowContextMenu(scma);

            // Do we need to show a context menu
            if (!scma.Cancel)
            {
                if (CommonHelper.ValidKryptonContextMenu(scma.KryptonContextMenu))
                {
                    scma.KryptonContextMenu.Show(_navigator, _navigator.PointToScreen(new Point(e.X, e.Y)));
                }
                else
                {
                    if (CommonHelper.ValidContextMenuStrip(scma.ContextMenuStrip))
                    {
                        scma.ContextMenuStrip.Show(_navigator.PointToScreen(new Point(e.X, e.Y)));
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void kryptonNavigator1_ShowContextMenu(object sender, ShowContextMenuArgs e)
        {
            // Yes we want to show a context menu
            e.Cancel = false;

            // Provide the navigator specific menu
            e.KryptonContextMenu = kcmNavigator;

            // Only enable the appropriate options
            kcmFirst.Enabled = (kryptonNavigator1.SelectedIndex > 0);
            kcmPrevious.Enabled = (kryptonNavigator1.SelectedIndex > 0);
            kcmNext.Enabled = (kryptonNavigator1.SelectedIndex < (kryptonNavigator1.Pages.Count - 1));
            kcmLast.Enabled = (kryptonNavigator1.SelectedIndex < (kryptonNavigator1.Pages.Count - 1));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Raises the ShowContextMenu event.
 /// </summary>
 /// <param name="e">A ShowContextMenuArgs containing event data.</param>
 protected internal virtual void OnShowContextMenu(ShowContextMenuArgs e)
 {
     if (ShowContextMenu != null)
         ShowContextMenu(this, e);
 }
        /// <summary>
        /// Processes the RightClick event from the button. 
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">An EventArgs containing the event data.</param>
        protected virtual void OnRightClick(object sender, MouseEventArgs e)
        {
            // Can only select the page if not already selected and allowed to select a tab
            if ((_navigator.SelectedPage != _page) && _navigator.AllowTabSelect)
                _navigator.SelectedPage = _page;

            // Generate event so user can decide what, if any, context menu to show
            ShowContextMenuArgs scma = new ShowContextMenuArgs(_page, _navigator.Pages.IndexOf(_page));
            _navigator.OnShowContextMenu(scma);

            // Do we need to show a context menu
            if (!scma.Cancel)
            {
                if (CommonHelper.ValidKryptonContextMenu(scma.KryptonContextMenu))
                    scma.KryptonContextMenu.Show(_navigator, _navigator.PointToScreen(new Point(e.X, e.Y)));
                else
                {
                    if (CommonHelper.ValidContextMenuStrip(scma.ContextMenuStrip))
                        scma.ContextMenuStrip.Show(_navigator.PointToScreen(new Point(e.X, e.Y)));
                }
            }
        }
        private void OnShowContextMenu(object sender, ShowContextMenuArgs e)
        {
            // Make sure we have a menu for displaying
            if (e.KryptonContextMenu == null)
                e.KryptonContextMenu = new KryptonContextMenu();

            // Use event to allow customization of the context menu
            CancelDropDownEventArgs args = new CancelDropDownEventArgs(e.KryptonContextMenu, e.Item);
            args.Cancel = e.Cancel;
            OnPageDropDownClicked(args);
            e.Cancel = args.Cancel;
        }