Class that provides utility methods for the System.Windows.Forms.DockStyle class
示例#1
0
        /// <summary>
        /// Constructs a <see cref="MainTitleIconControlWin"/>
        /// </summary>
        public MainTitleIconControlWin(IControlFactory controlFactory)
        {
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            _controlFactory = controlFactory;
            _panel          = _controlFactory.CreatePanel();
            ((PanelWin)_panel).BackgroundImage = CollapsiblePanelResource.headergradient;
            _panel.BackColor = Color.Transparent;
            _panel.Dock      = Habanero.Faces.Base.DockStyle.Top;

            _panel.Height = 23;

            _icon = _controlFactory.CreateLabel();
            ((LabelWin)_icon).BackgroundImage = CollapsiblePanelResource.headergradient;
            _icon.BackColor = Color.Transparent;
            ((LabelWin)_icon).BackgroundImageLayout = ImageLayout.Center;
            _icon.Dock = Habanero.Faces.Base.DockStyle.Left;
            _icon.Size = new Size(20, 20);

            _title           = _controlFactory.CreateLabel();
            _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);
            _panel.MaximumSize = new Size(2000, 23);
            this.Dock          = DockStyleWin.GetDockStyle(DockStyle.Top);
            this.Controls.Add((PanelWin)_panel);
            this.Height = 23;
        }
示例#2
0
 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);
 }