/// <summary>
        ///     Handles the removal of buttons from the menu bar.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RemoveButtonClick(object sender, EventArgs e)
        {
            var menu = ActiveMenu.GetInstance(this);

            if (menu.Items.Count > 0)
            {
                menu.Items.RemoveAt(menu.Items.Count - 1);
            }
        }
示例#2
0
        private void EkleButon(string yazi, EventHandler handler) //Yeni sekme + butonu oluşturmak
        {
            IActiveMenu  menu = ActiveMenu.GetInstance(this);
            ActiveButton btn  = new ActiveButton();

            btn.Text    = null;
            btn.Dock    = DockStyle.Fill;
            btn.Visible = false;
            menu.Items.Add(btn);
            ActiveButton button = new ActiveButton();

            button.Font      = new Font("Symbol", 12, FontStyle.Regular);
            button.Text      = yazi;
            button.FlatStyle = FlatStyle.Flat;
            int    argbRenk = (int)Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM", "ColorizationColor", null); //Regeditte kayıtlı olan renk değerinin ondalık değeri
            string rif      = ConverterToHex(System.Drawing.Color.FromArgb(argbRenk));
            Color  renk     = HexToColor(rif);

            if (renk == Color.White || renk == Color.Black)
            {
                button.ForeColor = Color.Black;
                if (renk == Color.White)
                {
                    button.FlatAppearance.BorderColor = Color.FromKnownColor(KnownColor.Highlight);
                }
                else
                {
                    button.FlatAppearance.BorderColor = Color.Black;
                }
                button.BackColor = renk;
            }
            else
            {
                button.ForeColor = Color.White;
                button.FlatAppearance.BorderColor = button.ForeColor;
                button.BackColor = renk;
            }
            SetStyle(ControlStyles.SupportsTransparentBackColor, true); //Transparan renk kodlarında destekelemi ve hata vermemesi için transparan desteği eklemek
            //button.FlatAppearance.BorderColor = //Color.FromKnownColor(KnownColor.Highlight);
            button.Cursor    = Cursors.Hand;
            button.ForeColor = Color.Black;
            menu.ToolTip.SetToolTip(button, "Yeni Sekme");
            button.Click += handler;
            menu.Items.Add(button);
        }
示例#3
0
        private void EkleButon(string yazi, EventHandler handler) //Yeni sekme + butonu oluşturmak
        {
            IActiveMenu  menu       = ActiveMenu.GetInstance(this);
            ActiveButton buttonNull = new ActiveButton();

            buttonNull.Text = null;
            buttonNull.Dock = DockStyle.Fill;
            buttonNull.Hide();
            menu.Items.Add(buttonNull);
            ActiveButton button = new ActiveButton();

            button.Text      = yazi;
            button.Cursor    = Cursors.Hand;
            button.ForeColor = Color.Black;
            menu.ToolTip.SetToolTip(button, "Yeni Sekme");
            button.Click += handler;
            menu.Items.Add(button);
        }
示例#4
0
        private void EkleButon(string yazi, EventHandler handler, string aciklama, Font fnt, FlatStyle flt, Color clr) //Yeni sekme + butonu oluşturmak
        {
            IActiveMenu menu = ActiveMenu.GetInstance(this);

            if (bos == 0)
            {
                ActiveButton btn = new ActiveButton();
                btn.Text    = null;
                btn.Dock    = DockStyle.Fill;
                btn.Visible = false;
                menu.Items.Add(btn);
                bos++;
            }
            ActiveButton button = new ActiveButton();

            button.Text   = yazi;
            button.Font   = fnt;//new Font("symbol", 12, FontStyle.Regular);
            button.Cursor = Cursors.Hand;
            if (button.Text == "")
            {
                // button.Image = Properties.Resources.search_13_16;
                button.ForeColor = Color.Black;
            }
            button.BackColor = clr;
            button.FlatStyle = flt;
            button.FlatAppearance.BorderSize = 0;
            //button.FlatAppearance.BorderColor = Color.FromArgb(30,30,30);
            //button.Image = Properties.Resources.ekle;
            menu.ToolTip.SetToolTip(button, aciklama);
            button.Click += handler;
            // = ContentAlignment.TopLeft;
            //button.Image = Properties.Resources.ekle;
            menu.Items.Add(button);
            if (bos == 1)
            {
                ActiveButton btn = new ActiveButton();
                btn.Text    = null;
                btn.Dock    = DockStyle.Fill;
                btn.Visible = false;
                menu.Items.Add(btn);
                bos++;
            }
        }
        /// <summary>
        ///     Helper method for adding items to the menu bar.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="handler"></param>
        private IActiveButton AddButton(string text, Color backColor, EventHandler handler)
        {
            // get an instance of IActiveMenu used to attach
            // buttons to the form
            var menu = ActiveMenu.GetInstance(this);

            // define a new button
            var button = menu.Items.CreateItem(text, handler);

            button.ToolTipText = "Tooltip " + button.Text;
            button.BackColor   = backColor;

            // add the button to the menu
            menu.Items.Add(button);

            errorLabel.Text = "";
            buttonText.Text = buttonInt++.ToString();

            return(button);
        }
示例#6
0
        /// <summary>
        ///     Helper method for adding items to the menu bar.
        /// </summary>
        /// <param name = "text"></param>
        /// <param name = "handler"></param>
        private void AddButton(string text, EventHandler handler)
        {
            // get an instance of IActiveMenu used to attach
            // buttons to the form
            IActiveMenu menu = ActiveMenu.GetInstance(this);

            // define a new button
            ActiveButton button = new ActiveButton();

            button.Text = text;
            menu.ToolTip.SetToolTip(button, "Tooltip " + button.Text);
            button.BackColor = colorSwitch.BackColor;
            button.Click    += handler;

            // add the button to the menu
            menu.Items.Add(button);

            errorLabel.Text = "";
            buttonText.Text = (buttonInt++).ToString();
        }