Beispiel #1
0
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            if (e.Item is ToolStripButton)
            {
                EmojiMenuBarSelectedItem i = (EmojiMenuBarSelectedItem)e.Item.Tag;

                if (this.SelectedItem == i)
                {
                    Rectangle rec = new Rectangle(0, 1, e.Item.Bounds.Width - 1, e.Item.Bounds.Height - 2);

                    using (GraphicsPath path = rec.Rounded(3))
                    {
                        using (SolidBrush sb = new SolidBrush(Color.Gainsboro))
                            e.Graphics.FillPath(sb, path);

                        using (Pen pen = new Pen(Color.Gray, 1))
                            e.Graphics.DrawPath(pen, path);
                    }
                }
                else if (e.Item.Selected)
                {
                    Rectangle rec = new Rectangle(0, 1, e.Item.Bounds.Width - 1, e.Item.Bounds.Height - 2);

                    using (GraphicsPath path = rec.Rounded(3))
                        using (Pen pen = new Pen(Color.Gray, 1))
                            e.Graphics.DrawPath(pen, path);
                }
            }
        }
Beispiel #2
0
        private void ToolstripItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem is ToolStripButton)
            {
                EmojiMenuBarSelectedItem item = (EmojiMenuBarSelectedItem)e.ClickedItem.Tag;

                if (this.mbar.SelectedItem == item)
                {
                    return;
                }

                this.mbar.SelectedItem = item;
                this.toolStrip1.Invalidate();

                while (this.panel1.Controls.Count > 0)
                {
                    this.panel1.Controls.RemoveAt(0);
                }

                switch (item)
                {
                case EmojiMenuBarSelectedItem.People:
                    this.panel1.Controls.Add(this.e_people);
                    break;

                case EmojiMenuBarSelectedItem.Nature:
                    this.panel1.Controls.Add(this.e_nature);
                    break;

                case EmojiMenuBarSelectedItem.Objects:
                    this.panel1.Controls.Add(this.e_objects);
                    break;

                case EmojiMenuBarSelectedItem.Places:
                    this.panel1.Controls.Add(this.e_places);
                    break;

                case EmojiMenuBarSelectedItem.Symbols:
                    this.panel1.Controls.Add(this.e_symbols);
                    break;
                }

                if (this.panel1.Controls.Count > 0)
                {
                    this.panel1.Controls[0].BeginInvoke((Action)(() => this.panel1.Controls[0].Focus()));
                }
            }
        }
Beispiel #3
0
 public EmojiMenuBar()
 {
     this.SelectedItem = EmojiMenuBarSelectedItem.People;
 }