public Control CreateLevelControls(PModelObjectNavigatorPathLevel level, int x) { const int btnWidth = 40; Panel p = new Panel(); p.Location = new Point(x, 0); Label l = new Label(); p.Controls.Add(l); l.Text = level.UiControlName; l.TextAlign = System.Drawing.ContentAlignment.MiddleRight; l.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); l.AutoSize = true; int labWidth = l.Width; l.AutoSize = false; l.Width = labWidth; l.Height = this._navigatorControl.Height; p.Width = labWidth + 2 * btnWidth + 1; RNavigatorButton b = new RNavigatorButton(level, NAV_DIRECTION.UP); p.Controls.Add(b); b.Width = btnWidth; b.Height = this._navigatorControl.Height; b.Left = l.Width; b.Top = 0; //b.Click += new System.EventHandler(this._navButtonClick); b.BackgroundImage = global::Platform.Resource.arrow151; b.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; b.FlatStyle = System.Windows.Forms.FlatStyle.Flat; b = new RNavigatorButton(level, NAV_DIRECTION.DOWN); p.Controls.Add(b); b.Width = btnWidth; b.Height = this._navigatorControl.Height; b.Left = l.Width + btnWidth + 1; b.Top = 0; //b.Click += new System.EventHandler(this._navButtonClick); b.BackgroundImage = global::Platform.Resource.caret; b.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; b.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this._navigatorControl.Controls.Add(p); p.Parent = this._navigatorControl; return p; }
private int _createLevelButtons(Control owner, int depthTag, string text, int x) { int minBtnWidth = _conf.NavigatorMinButtonWidth; const int spacing = 1; Panel p = new Panel(); p.Location = new System.Drawing.Point(x, 0); Label l = new Label(); p.Controls.Add(l); l.Text = text; l.TextAlign = System.Drawing.ContentAlignment.TopCenter; l.Font = this.Font;// new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); l.AutoSize = true; int labWidth = Math.Max(l.Width, minBtnWidth * 2) + spacing * 2; int btnWidth = (labWidth - spacing) / 2; l.Height = 12; l.AutoSize = false; l.Width = labWidth; l.TextAlign = System.Drawing.ContentAlignment.TopCenter; p.Width = labWidth; RNavigatorButton b = new RNavigatorButton(depthTag, NAV_DIRECTION.UP); p.Controls.Add(b); b.Left = l.Left; b.Width = btnWidth; b.Top = l.Height; tableLayoutPanelButtons.Height = l.Width + b.Width; b.Height = btnWidth - l.Height; b.Anchor = AnchorStyles.Bottom; b.Click += new System.EventHandler(this._navButtonClick); b.BackgroundImage = global::ProfileCut.Resource.arrow151; b.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; b.FlatStyle = System.Windows.Forms.FlatStyle.Flat; b = new RNavigatorButton(depthTag, NAV_DIRECTION.DOWN); p.Controls.Add(b); b.Left = l.Left + btnWidth + spacing; b.Width = btnWidth; b.Top = l.Height; b.Height = btnWidth - l.Height; b.Click += new System.EventHandler(this._navButtonClick); b.BackgroundImage = global::ProfileCut.Resource.caret; b.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; b.FlatStyle = System.Windows.Forms.FlatStyle.Flat; splitContainerMain.SplitterDistance = splitContainerMain.Height - b.Height - l.Height - 13; owner.Controls.Add(p); p.Parent = owner; return p.Width + x; }