public IconActionMenu() { m_MenuIcon = new PictureButton(); m_MenuIcon.BackColor = System.Drawing.Color.BlueViolet; m_MenuIcon.LabelBackColor = Color.White; m_MenuIcon.Click += menuIcon_Click; }
public IconMenuContainer() { m_Offset = new Point(k_Spacing, k_Spacing); m_MenuForm = new Form(); m_MenuForm.FormClosing += m_MenuForm_Closing; if (!MenuSize.IsEmpty) { m_MenuForm.Size = MenuSize; } m_MenuForm.FormBorderStyle = FormBorderStyle.None; m_MenuForm.StartPosition = FormStartPosition.CenterScreen; m_ButtonBack = new Button(); m_ButtonBack.Size = sr_ButtonBackSize; m_ButtonBack.Text = "Back"; m_MenuForm.Controls.Add(m_ButtonBack); m_ButtonBack.Location = m_Offset; m_ButtonBack.Click += buttonBack_Click; m_Offset.Y += m_ButtonBack.Size.Height + k_Spacing; m_PictureButton = new PictureButton(); m_PictureButton.Click += menuIcon_Click; m_PictureButton.BackColor = Color.BlueViolet; m_PictureButton.LabelBackColor = Color.White; m_MenuItems = new LinkedList <IIconMenuItem>(); }
public void AddMenuItem(IIconMenuItem i_MenuItem) { m_MenuItems.AddLast(i_MenuItem); m_MenuForm.Controls.Add(i_MenuItem.MenuIcon); Point insertLocation = new Point(); if (m_Offset.X + m_PictureButton.Width + k_Spacing < m_MenuForm.Size.Width) { insertLocation = m_Offset; } else { m_Offset.X = k_Spacing; m_Offset.Y += m_PictureButton.Height + k_Spacing; insertLocation = m_Offset; } PictureButton menuIcon = i_MenuItem.MenuIcon; menuIcon.Location = insertLocation; m_Offset.X += m_PictureButton.Width + k_Spacing; }