/// <summary> /// Creates a <see cref="CollapsibleMenuItemCollectionWin"/> for a habaneroMenuItem. /// </summary> /// <param name="controlFactory"></param> /// <param name="habaneroMenuItem"></param> public CollapsibleMenuItemWin(IControlFactory controlFactory, HabaneroMenu.Item habaneroMenuItem) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } _habaneroMenuItem = habaneroMenuItem; if (habaneroMenuItem != null) { this.Text = _habaneroMenuItem.Name; this.FlatStyle = FlatStyle.Flat; this.BackgroundImage = CollapsiblePanelResource.smBack; this.Image = CollapsiblePanelResource.nbItemBullet; this.TextImageRelation = TextImageRelation.ImageBeforeText; this.TextAlign = ContentAlignment.MiddleLeft; this.Click += ChangeButtonIcon; } MenuItems = new CollapsibleMenuItemCollectionWin(this); }
private void InitialiseSubMenuItem(string name) { this.Text = name; this.Name = name; this.PinLabel.Visible = false; this.CollapseButton.Text = name; this.Dock = DockStyleWin.GetDockStyle(DockStyle.Top); this.CollapseButton.ForeColor = Color.White; ((ButtonWin)this.CollapseButton).BackgroundImage = CollapsiblePanelResource.headergradient; ((ButtonWin)this.CollapseButton).FlatStyle = FlatStyle.Flat; this.Collapsed = true; this.CollapseButton.Click += delegate { if (this.Collapsed) { this.Collapsed = false; } }; this.MinimumSize = new Size(this.CollapseButton.Width, this.CollapseButton.Height); this.Size = new Size(this.CollapseButton.Width, this.CollapseButton.Height); MenuItems = new CollapsibleMenuItemCollectionWin(this); }
/// <summary> /// Creates a <see cref="CollapsibleMenuItemCollectionWin"/> with a name. /// </summary> /// <param name="name"></param> public CollapsibleMenuItemWin(string name) { this.Text = name; MenuItems = new CollapsibleMenuItemCollectionWin(this); }