//public void UpdateAllItems(ControlMenu controlMenu) //{ // for (int i = 0;i<this._showedItems.Count;i++) // { // this.UpdateItem(controlMenu, i, controlMenu._); // } //} public void UpdateItem(ControlMenu controlMenu, int index, ControlMenuItem controlMenuItem) { Label showedItem = this._showedItems[index]; string prefix = null; switch (showedItem.TextAlign) { case ContentAlignment.MiddleCenter: case ContentAlignment.BottomCenter: case ContentAlignment.TopCenter: prefix = (controlMenuItem.HaveChildren) ? " " : string.Empty; break; default: prefix = string.Empty; break; } showedItem.Text = string.Format("{0}{1}{2}", prefix, controlMenuItem.Caption, ((controlMenuItem.HaveChildren) ? this._arrowRightText : string.Empty) ); if (controlMenuItem.Selected) { showedItem.ForeColor = Color.Silver; showedItem.BackColor = controlMenu._itemsColor; } else { showedItem.ForeColor = controlMenu._itemsColor; showedItem.BackColor = controlMenu._formContent.TransparencyKey; } }
internal void InitializeItems(ControlMenu controlMenu, int count) { Label arrowTop = this.lblArrowTop; if (this._showedItems != null) { foreach (Label showedItem in this._showedItems) { pnlItems.Controls.Remove(showedItem); } this._showedItems.Clear(); this.pnlItems.Controls.Remove((this.lblArrowTop)); } else { this._showedItems = new List <Label>(); } for (int i = 0; i < count; i++) { Label showedItem = new Label(); showedItem.Dock = DockStyle.Top; showedItem.TextAlign = controlMenu._itemsAlignment; showedItem.Font = controlMenu._itemsFont; showedItem.Height = controlMenu._itemHeight; this._showedItems.Add(showedItem); } for (int i = count - 1; i >= 0; i--) { this.pnlItems.Controls.Add(this._showedItems[i]); } this.pnlItems.Controls.Add(arrowTop); }
private void FormBackground_Load(object sender, EventArgs e) { ControlMenu controlMenu = this.Tag as ControlMenu; this.BackColor = controlMenu._backgroundColor; this.Opacity = controlMenu._backgroundOpacity; }
public void Draw(ControlMenu controlMenu) { //int i = controlMenu._offsetIndex; //while (i < this.Count && i-controlMenu._offsetIndex<controlMenu._showedItemsCount) //{ //} //foreach (ControlMenuItem item in this) //{ // item.Draw(controlMenu); //} }
private void FormContent_Load(object sender, EventArgs e) { ControlMenu controlMenu = this.Tag as ControlMenu; switch (controlMenu._frameVisibility) { case FrameVisibility.Full: this.pnlFrame.BackColor = controlMenu._frameColor; this.splHeaderItems.BackColor = controlMenu._frameColor; break; case FrameVisibility.HeaderOnly: this.pnlFrame.BackColor = this.TransparencyKey; this.splHeaderItems.BackColor = controlMenu._frameColor; break; case FrameVisibility.None: this.pnlFrame.BackColor = this.TransparencyKey; this.splHeaderItems.BackColor = this.TransparencyKey; break; } this.lblHeader.Visible = !string.IsNullOrEmpty(controlMenu._headerText); if (!string.IsNullOrEmpty(controlMenu._headerText)) { lblHeader.Text = controlMenu._headerText; } this.lblHeader.ForeColor = controlMenu._frameColor; this.lblHeader.Font = controlMenu._headerFont; this.lblHeader.TextAlign = controlMenu._headerAlign; this.lblHeader.Height = controlMenu._itemHeight; this.lblArrowTop.Font = controlMenu._itemsFont; this.lblArrowTop.ForeColor = controlMenu._itemsColor; this.lblArrowTop.Height = controlMenu._itemHeight; this.lblArrowBottom.Font = controlMenu._itemsFont; this.lblArrowBottom.ForeColor = controlMenu._itemsColor; this.lblArrowBottom.Height = controlMenu._itemHeight; this.lblHeader.Focus(); this._dragActive = false; this.ChangeState(false, true); }
public FormContent(ControlMenu controlMenu) { InitializeComponent(); this._controlMenu = controlMenu; }