コード例 #1
0
        void InitNavigateBarButton()
        {
            // Control

            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);

            this.UpdateStyles();

            //this.ResizeRedraw = true;
            this.MinimumSize = new Size(NavigateBar.OVER_FLOW_BUTTON_WIDTH, minimumButtonHeight);
            this.Cursor      = Cursors.Hand;

            // Menu

            menu = new ButtonContextMenu(this);
            this.ContextMenuStrip = menu;

            // ToolTip

            toolTip            = new ToolTip();
            toolTip.ShowAlways = true;

            // OverFlowPanelButton (Panel içerisine sığmadığında overflowpanel içerisinde bu eleman gösteriliyor)
            // If cannot display navigatebutton then show this button on overflowpanel

            overFlowPanelButton = new NavigateBarOverFlowPanelButton(this);
            overFlowPanelButton.NavigateBarButton = this;
            overFlowPanelButton.IsSelected        = isSelected;

            // ContextMenuItem (OverFlowPanel sığmadığında menüde bu eleman gösteriliyor)
            // If cannot display on overflowpanel then show on contextmenu

            contextMenuItem        = new NavigateBarOverFlowPanelMenuItem(this, false);
            contextMenuItem.Click += delegate(object sender, EventArgs e)
            {
                this.PerformClick();
            };
        }
コード例 #2
0
        /// <summary>
        /// Eklenen butonlara göre overflowpanel için contextmenuyu oluşturur
        /// </summary>
        void BuildContextMenuItems()
        {
            mnContextMenu.Items.Clear();
            mnAddRemoveButton.DropDownItems.Clear();

            mnContextMenu.Items.Add(mnShowMoreButton);
            mnContextMenu.Items.Add(mnShowFewerButton);
            mnContextMenu.Items.Add(mnMenuOptions);
            mnContextMenu.Items.Add(mnAddRemoveButton);

            // NavigateBarButton görünümleri değiştiren ContextMenu oluşturuluyor
            // Building context menu navigatebarbutton in collection

            foreach (NavigateBarButton nvbButton in navigateBar.NavigateBarButtons)
            {
                // Her zaman gösterilecek
                // If always show skip
                if (nvbButton.IsAlwaysDisplayed)
                {
                    continue;
                }

                NavigateBarOverFlowPanelMenuItem ofpmi = new NavigateBarOverFlowPanelMenuItem(nvbButton, true);
                ofpmi.Click += delegate(object sender, EventArgs e)
                {
                    // Seçilen Button Panel içerisindek kaldırılır yada eklenilir
                    // Show or Hide NavigatebarButton in panel
                    if (sender is NavigateBarOverFlowPanelMenuItem)
                    {
                        NavigateBarButton nvb = (sender as NavigateBarOverFlowPanelMenuItem).NavigateBarButton;
                        nvb.IsDisplayed = !nvb.IsDisplayed;
                    }
                };

                mnAddRemoveButton.DropDownItems.Add(ofpmi);
            }
        }
コード例 #3
0
        void InitNavigateBarButton()
        {
            // Control

            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);

            this.UpdateStyles();

            //this.ResizeRedraw = true;
            this.MinimumSize = new Size(NavigateBar.OVER_FLOW_BUTTON_WIDTH, minimumButtonHeight);
            this.Cursor = Cursors.Hand;

            // Menu

            menu = new ButtonContextMenu(this);
            this.ContextMenuStrip = menu;

            // ToolTip

            toolTip = new ToolTip();
            toolTip.ShowAlways = true;

            // OverFlowPanelButton (Panel içerisine sığmadığında overflowpanel içerisinde bu eleman gösteriliyor)
            // If cannot display navigatebutton then show this button on overflowpanel

            overFlowPanelButton = new NavigateBarOverFlowPanelButton(this);
            overFlowPanelButton.NavigateBarButton = this;
            overFlowPanelButton.IsSelected = isSelected;

            // ContextMenuItem (OverFlowPanel sığmadığında menüde bu eleman gösteriliyor)
            // If cannot display on overflowpanel then show on contextmenu

            contextMenuItem = new NavigateBarOverFlowPanelMenuItem(this, false);
            contextMenuItem.Click += delegate(object sender, EventArgs e)
                {
                    this.PerformClick();
                };

        }
コード例 #4
0
        void InitNavigateBarOverFlowPanel()
        {
            // Control

            this.Dock        = DockStyle.Fill;
            this.Height      = navigateBar.OverFlowPanelHeight;
            this.MinimumSize = new Size(NavigateBar.OVER_FLOW_BUTTON_WIDTH, 20);

            #region Context Menu Items

            mnContextMenu          = new ContextMenuStrip();
            mnContextMenu.Opening += delegate(object sender, CancelEventArgs e)
            {
                foreach (ToolStripItem tsi in mnContextMenu.Items)
                {
                    tsi.ForeColor = SystemColors.MenuText;
                }
            };

            // Menü kapatıldığında okun clickini kaldır
            // Closed context menu remove selected state on arrow button
            mnContextMenu.Closed += delegate(object sender, ToolStripDropDownClosedEventArgs e)
            {
                panelArrowBtn.IsSelected = false;
                Refresh();
            };

            // Show More Button menu item

            mnShowMoreButton        = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnShowMoreButton.Text   = Properties.Resources.TEXT_SHOW_MORE_BUTTONS;
            mnShowMoreButton.Image  = Properties.Resources.ArrowUp;
            mnShowMoreButton.Click += delegate(object sender, EventArgs e)
            {
                NavigateBar.MoveButtons(MoveType.MoveUp);
            };

            // Show Fewer Button menu item

            mnShowFewerButton        = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnShowFewerButton.Text   = Properties.Resources.TEXT_SHOW_FEWER_BUTTONS;
            mnShowFewerButton.Image  = Properties.Resources.ArrowDown;
            mnShowFewerButton.Click += delegate(object sender, EventArgs e)
            {
                NavigateBar.MoveButtons(MoveType.MoveDown);
            };

            // Seçenek
            // Menu Options menu item
            mnMenuOptions        = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnMenuOptions.Text   = Properties.Resources.TEXT_MENU_OPTIONS;
            mnMenuOptions.Click += delegate(object sender, EventArgs e)
            {
                NavigateBar.RunMenuOptionsDialog();
            };

            // Ekle / Kaldır
            // Add or Remove Button menu item
            mnAddRemoveButton                  = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnAddRemoveButton.Text             = Properties.Resources.TEXT_ADD_OR_REMOVE_BUTTON;
            mnAddRemoveButton.DropDownOpening += delegate(object sender, EventArgs e)
            {
                foreach (NavigateBarOverFlowPanelMenuItem item in mnAddRemoveButton.DropDownItems)
                {
                    item.Checked = item.NavigateBarButton.IsDisplayed;
                }
            };

            #endregion

            #region Arrow button for ContextMenu

            panelArrowNavBtn             = new NavigateBarButton(Properties.Resources.TEXT_CONFIGURE_BUTTONS);
            panelArrowNavBtn.NavigateBar = NavigateBar;
            panelArrowNavBtn.ToolTipText = Properties.Resources.TEXT_CONFIGURE_BUTTONS;

            panelArrowBtn = new NavigateBarOverFlowPanelButton(panelArrowNavBtn);

            this.SetPanelArrowPosition();

            panelArrowBtn.IsSelected    = false;
            panelArrowBtn.Visible       = true;
            panelArrowBtn.IsArrowButton = true;
            panelArrowBtn.MouseClick   += new MouseEventHandler(ArrowButton_MouseClick);

            this.Controls.Add(panelArrowBtn);

            #endregion

            this.ResizeRedraw = true;

            //
        }
        void InitNavigateBarOverFlowPanel()
        {

            // Control

            this.Dock = DockStyle.Fill;
            this.Height = navigateBar.OverFlowPanelHeight;
            this.MinimumSize = new Size(NavigateBar.OVER_FLOW_BUTTON_WIDTH, 20);

            #region Context Menu Items

            mnContextMenu = new ContextMenuStrip();
            mnContextMenu.Opening += delegate(object sender, CancelEventArgs e)
                {
                    foreach (ToolStripItem tsi in mnContextMenu.Items)
                        tsi.ForeColor = SystemColors.MenuText;
                };

            // Menü kapatıldığında okun clickini kaldır
            // Closed context menu remove selected state on arrow button
            mnContextMenu.Closed += delegate(object sender, ToolStripDropDownClosedEventArgs e)
                {
                    panelArrowBtn.IsSelected = false;
                    Refresh();
                };

            // Show More Button menu item

            mnShowMoreButton = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnShowMoreButton.Text = Properties.Resources.TEXT_SHOW_MORE_BUTTONS;
            mnShowMoreButton.Image = Properties.Resources.ArrowUp;
            mnShowMoreButton.Click += delegate(object sender, EventArgs e)
                {
                    NavigateBar.MoveButtons(MoveType.MoveUp);
                };

            // Show Fewer Button menu item

            mnShowFewerButton = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnShowFewerButton.Text = Properties.Resources.TEXT_SHOW_FEWER_BUTTONS;
            mnShowFewerButton.Image = Properties.Resources.ArrowDown;
            mnShowFewerButton.Click += delegate(object sender, EventArgs e)
                 {
                     NavigateBar.MoveButtons(MoveType.MoveDown);
                 };

            // Seçenek
            // Menu Options menu item
            mnMenuOptions = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnMenuOptions.Text = Properties.Resources.TEXT_MENU_OPTIONS;
            mnMenuOptions.Click += delegate(object sender, EventArgs e)
                {
                    NavigateBar.RunMenuOptionsDialog();
                };

            // Ekle / Kaldır
            // Add or Remove Button menu item
            mnAddRemoveButton = new NavigateBarOverFlowPanelMenuItem(null, false);
            mnAddRemoveButton.Text = Properties.Resources.TEXT_ADD_OR_REMOVE_BUTTON;
            mnAddRemoveButton.DropDownOpening += delegate(object sender, EventArgs e)
                {
                    foreach (NavigateBarOverFlowPanelMenuItem item in mnAddRemoveButton.DropDownItems)
                        item.Checked = item.NavigateBarButton.IsDisplayed;
                };

            #endregion

            #region Arrow button for ContextMenu

            panelArrowNavBtn = new NavigateBarButton(Properties.Resources.TEXT_CONFIGURE_BUTTONS);
            panelArrowNavBtn.NavigateBar = NavigateBar;
            panelArrowNavBtn.ToolTipText = Properties.Resources.TEXT_CONFIGURE_BUTTONS;

            panelArrowBtn = new NavigateBarOverFlowPanelButton(panelArrowNavBtn);

            this.SetPanelArrowPosition();

            panelArrowBtn.IsSelected = false;
            panelArrowBtn.Visible = true;
            panelArrowBtn.IsArrowButton = true;
            panelArrowBtn.MouseClick += new MouseEventHandler(ArrowButton_MouseClick);

            this.Controls.Add(panelArrowBtn);

            #endregion

            this.ResizeRedraw = true;

            //

        }
        /// <summary>
        /// Eklenen butonlara göre overflowpanel için contextmenuyu oluşturur
        /// </summary>
        void BuildContextMenuItems()
        {

            mnContextMenu.Items.Clear();
            mnAddRemoveButton.DropDownItems.Clear();

            mnContextMenu.Items.Add(mnShowMoreButton);
            mnContextMenu.Items.Add(mnShowFewerButton);
            mnContextMenu.Items.Add(mnMenuOptions);
            mnContextMenu.Items.Add(mnAddRemoveButton);

            // NavigateBarButton görünümleri değiştiren ContextMenu oluşturuluyor
            // Building context menu navigatebarbutton in collection

            foreach (NavigateBarButton nvbButton in navigateBar.NavigateBarButtons)
            {

                // Her zaman gösterilecek
                // If always show skip
                if (nvbButton.IsAlwaysDisplayed) continue;

                NavigateBarOverFlowPanelMenuItem ofpmi = new NavigateBarOverFlowPanelMenuItem(nvbButton, true);
                ofpmi.Click += delegate(object sender, EventArgs e)
                {
                    // Seçilen Button Panel içerisindek kaldırılır yada eklenilir
                    // Show or Hide NavigatebarButton in panel
                    if (sender is NavigateBarOverFlowPanelMenuItem)
                    {
                        NavigateBarButton nvb = (sender as NavigateBarOverFlowPanelMenuItem).NavigateBarButton;
                        nvb.IsDisplayed = !nvb.IsDisplayed;

                    }
                };

                mnAddRemoveButton.DropDownItems.Add(ofpmi);

            }

        }