Details for a close button action event.
Inheritance: KryptonPageCancelEventArgs
コード例 #1
0
        /// <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)));
                    }
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ComponentFactory/Krypton
        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));
        }
コード例 #3
0
ファイル: KryptonNavigator.cs プロジェクト: xdarke/Krypton
 /// <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);
 }
コード例 #4
0
        /// <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)));
                }
            }
        }
コード例 #5
0
        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;
        }