private void InitialiseSubMenuItem(string name) { this.Text = name; this.Name = name; this.PinLabel.Visible = false; this.CollapseButton.Text = name; this.Dock = DockStyleVWG.GetDockStyle(DockStyle.Top); this.CollapseButton.ForeColor = Color.White; this.CollapseButton.Font = new Font("Verdana", 10); ((ButtonVWG)this.CollapseButton).BackgroundImage = "Images.headergradient.png"; ((ButtonVWG)this.CollapseButton).FlatStyle = FlatStyle.Flat; this.Collapsed = true; this.CollapseButton.Click += delegate { if (this.Collapsed) { this.Collapsed = false; } }; this.MinimumSize = new System.Drawing.Size(this.CollapseButton.Width, this.CollapseButton.Height); this.Size = new System.Drawing.Size(this.CollapseButton.Width, this.CollapseButton.Height); MenuItems = new CollapsibleMenuItemCollectionVWG(this); }
/// <summary> /// Creates a <see cref="CollapsibleMenuItemCollectionVWG"/> for a habaneroMenuItem. /// </summary> /// <param name="controlFactory"></param> /// <param name="habaneroMenuItem"></param> public CollapsibleMenuItemVWG(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 = "Images.smBack-white.gif"; this.Image = "Images.nbItemBullet.gif"; this.TextImageRelation = TextImageRelation.ImageBeforeText; this.TextAlign = ContentAlignment.MiddleLeft; this.Font = new Font("Verdana", 9); this.Dock = DockStyleVWG.GetDockStyle(DockStyle.Top); this.Click += ChangeButtonIcon; } MenuItems = new CollapsibleMenuItemCollectionVWG(this); }
/// <summary> /// Constructs a <see cref="MainTitleIconControlVWG"/> /// </summary> public MainTitleIconControlVWG(IControlFactory controlFactory) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } _controlFactory = controlFactory; _panel = _controlFactory.CreatePanel(); ((PanelVWG)_panel).BackgroundImage = @"Images.headergradient.png"; _panel.BackColor = Color.Transparent; _panel.Dock = Habanero.Faces.Base.DockStyle.Top; _panel.Height = 23; this.Size = new Size(_panel.Width, _panel.Height); _icon = _controlFactory.CreateLabel(); ((LabelVWG)_icon).BackgroundImage = ""; _icon.BackColor = Color.Transparent; ((LabelVWG)_icon).BackgroundImageLayout = ImageLayout.Center; _icon.Dock = Habanero.Faces.Base.DockStyle.Left; _icon.Size = new Size(20, 20); _title = _controlFactory.CreateLabel(); _title.Font = new Font("Verdana", 10); _title.Dock = Habanero.Faces.Base.DockStyle.Fill; _title.BackColor = Color.Transparent; _title.TextAlign = ContentAlignment.MiddleLeft; _title.ForeColor = Color.White; _panel.Controls.Add(_title); _panel.Controls.Add(_icon); this.Dock = DockStyleVWG.GetDockStyle(DockStyle.Top); this.Controls.Add((PanelVWG)_panel); this.Height = 23; }