private void SetTextButtons() { grouper1.Controls.Clear(); grouper1.Height = 35 + (getWidget().getTabNames().Length * 23); grouper2.Top = grouper1.Top + grouper1.Height + 10; int i = 0; foreach (string s in getWidget().getTabNames()) { RibbonStyle.RibbonMenuButton b = new RibbonStyle.RibbonMenuButton(); b.SetBounds(9, 25 + i * 23, 100, 23); b.Text = s; b.Click += new System.EventHandler(this.TextButton_Click); b.ColorBase = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(209)))), ((int)(((byte)(240))))); b.ColorBaseStroke = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(187)))), ((int)(((byte)(213))))); b.ColorOn = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(240)))), ((int)(((byte)(255))))); b.ColorOnStroke = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); b.ColorPress = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(224)))), ((int)(((byte)(255))))); b.ColorPressStroke = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); b.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; b.ImageLocation = RibbonStyle.RibbonMenuButton.e_imagelocation.Left; b.ImageOffset = 2; b.KeepPress = true; b.SinglePressButton = false; b.FadingSpeed = 35; b.Name = i.ToString(); b.GroupPos = RibbonStyle.RibbonMenuButton.e_groupPos.Center; if (i == 0) { b.GroupPos = RibbonStyle.RibbonMenuButton.e_groupPos.Top; } if (i == getWidget().getTabNames().Length - 1) { b.GroupPos = RibbonStyle.RibbonMenuButton.e_groupPos.Bottom; } grouper1.Controls.Add(b); // if (i == getWidget().getSelectedTab()) b.Check(); i++; } }
private void Update() { WhatChanged(); int i = 0; int totalrows = 0; int blankrows = 1; if (verseSeparator == SongVerseSeparator.TwoBlankLines) { blankrows = 2; } try { if (renew) { #region renew RemoveBackground(); foreach (string line in oldLines) { string[] mystringarr = line.Split("\n".ToCharArray()); int rows = mystringarr.Length; // Background Panel CodeVendor.Controls.Grouper p = new CodeVendor.Controls.Grouper(); p.Height = (rows * textHeight) + 14; p.Width = rtePanel.Width + 1; p.Location = new Point(-1, (totalrows * textHeight) - 11); p.BackgroundGradientMode = CodeVendor.Controls.Grouper.GroupBoxGradientMode.ForwardDiagonal; //p.BackgroundColor = GetColor((SongListItem)Typelist[i]); //p.BackgroundGradientColor = Color.LightBlue; setColor(p, (LyricsType)Typelist[i]); p.GroupTitle = ""; p.BorderColor = Color.White; p.RoundCorners = 0; p.Hide(); rtePanel.Controls.Add(p); p.Name = i.ToString(); p.SendToBack(); p.Show(); //Button RibbonStyle.RibbonMenuButton b = new RibbonStyle.RibbonMenuButton(); b.SetBounds(0, (totalrows * textHeight), 30, (rows * textHeight) + 4); b.Text = ""; //b.Click += new System.EventHandler(this.TextButton_Click); b.MouseDown += new MouseEventHandler(b_MouseDown); b.ColorBase = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(209)))), ((int)(((byte)(240))))); b.ColorBaseStroke = System.Drawing.Color.FromArgb(((int)(((byte)(152)))), ((int)(((byte)(187)))), ((int)(((byte)(213))))); b.ColorOn = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(240)))), ((int)(((byte)(255))))); b.ColorOnStroke = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); b.ColorPress = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(224)))), ((int)(((byte)(255))))); b.ColorPressStroke = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); b.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; b.ImageLocation = RibbonStyle.RibbonMenuButton.e_imagelocation.Left; b.ImageOffset = 2; b.KeepPress = false; b.SinglePressButton = false; b.FadingSpeed = 35; b.Name = i.ToString(); b.ContextMenuStrip = this.contextMenuStrip; b.Arrow = RibbonStyle.RibbonMenuButton.e_arrow.ToDown; b.SplitButton = RibbonStyle.RibbonMenuButton.e_splitbutton.Yes; b.SplitDistance = b.Width; if ((LyricsType)Typelist[i] == LyricsType.Verse) { b.Image = global::DreamBeam.Properties.Resources.verse; } else if ((LyricsType)Typelist[i] == LyricsType.Chorus) { b.Image = global::DreamBeam.Properties.Resources.chorus; } else { b.Image = global::DreamBeam.Properties.Resources.Other; } b.MaxImageSize = new Point(16, 16); ButtonPanel.Controls.Add(b); if (verseSeparator == SongVerseSeparator.OneBlankLine) { separator = "\n\n"; } totalrows = rows + blankrows + totalrows; i++; } renew = false; #endregion } else { #region refresh while (i < Typelist.Count) { foreach (Control c in ButtonPanel.Controls) { if (c.Name == i.ToString()) { string[] mystringarr = oldLines[i].Split("\n".ToCharArray()); int rows = mystringarr.Length; ((RibbonStyle.RibbonMenuButton)c).SetBounds(0, (totalrows * textHeight), 30, (rows * textHeight) + 4); if ((LyricsType)Typelist[i] == LyricsType.Verse) { ((RibbonStyle.RibbonMenuButton)c).Image = global::DreamBeam.Properties.Resources.verse; } else if ((LyricsType)Typelist[i] == LyricsType.Chorus) { ((RibbonStyle.RibbonMenuButton)c).Image = global::DreamBeam.Properties.Resources.chorus; } else { ((RibbonStyle.RibbonMenuButton)c).Image = global::DreamBeam.Properties.Resources.Other; } totalrows = rows + blankrows + totalrows; i++; } } } totalrows = 0; i = 0; while (i < Typelist.Count) { foreach (Control c in rtePanel.Controls) { if (c.Name == i.ToString() && c.Visible) { string[] mystringarr = oldLines[i].Split("\n".ToCharArray()); int rows = mystringarr.Length; c.Hide(); setColor((CodeVendor.Controls.Grouper)c, (LyricsType)Typelist[i]); c.Location = new Point(-1, (totalrows * textHeight) - 11); c.Height = (rows * textHeight) + 14; c.Width = rtePanel.Width + 1; totalrows = rows + blankrows + totalrows; c.SendToBack(); c.Show(); rte.BringToFront(); i++; } } } #endregion } }catch (Exception e) {} }