//----------------------------------------------------------------------- private void colorizeRows() { bool switchColor = true; string lastGroup = ""; Color odd = Color.MintCream; Color even = Color.LightGray; foreach (Control i in panel2.Controls) { if (i is Panel) { tableRowTag tableRowTag = (tableRowTag)(((Panel)i).Tag); string currentGroup = (string)(tableRowTag.Get("Group")); //reassign if (currentGroup != lastGroup || currentGroup == null) { switchColor = !switchColor; } lastGroup = currentGroup; Color currntColor = (switchColor) ? odd : even; ((Panel)i).BackColor = currntColor; tableRowTag newTag = new tableRowTag(); newTag.Set("BgColor", currntColor); newTag.Set("Group", currentGroup); //reassign ((Panel)i).Tag = newTag; } } }
//--------------------------------------------------------------------------------------------------------- private void addTxtControlsLine(string parentName, string name, bool clickAble, bool hideAble, string tb1Text, string tb2Text, bool openAble, string controlType, bool controlSuccess) { tableRowTag tableRowTag = new tableRowTag(); tableRowTag.Set("Group", parentName); var pnl = new Panel { Name = "panel" + name, Size = new Size(450, 25), Location = new Point(0, 25 * Editor.lineCounter), Tag = tableRowTag, }; panel2.Controls.Add(pnl); var llbl = new LinkLabel { Name = "lbl" + name, Size = new Size(150, 25), Location = new Point(5, 0), Text = name, //LinkColor = Color.Black, }; var lbl = new Label { Name = "lbl" + name, Size = new Size(150, 25), Location = new Point(5, 0), Text = name, }; // tool tips from dictionary string hint = Editor.getHintforKey(name); new ToolTip().SetToolTip(llbl, hint); new ToolTip().SetToolTip(lbl, hint); string imgSrc = (controlSuccess) ? Editor.controlTypesResources[controlType] : Editor.controlTypesResources["error"]; object img = FOIE.Properties.Resources.ResourceManager.GetObject(imgSrc); var pb = new PictureBox { Name = "typePic" + name, Size = new Size(20, 20), Location = new Point(175, 0), Image = (Image)img, BackgroundImageLayout = ImageLayout.Stretch, Tag = controlType, }; var tb1 = new TextBox { Name = "tb" + name, Size = new Size(100, 25), Location = new Point(200, 0), Text = tb1Text, Tag = controlType, }; tb1.TextChanged += (sender, e) => { updateTxtBox(tb1, e); }; var tb2 = new TextBox { Name = "size" + name, Size = new Size(60, 25), Location = new Point(305, 0), Text = tb2Text, Enabled = false, }; new ToolTip().SetToolTip(pb, controlType); Panel p = panel2.Controls.Find("panel" + name, true).FirstOrDefault() as Panel; p.Controls.Add(tb1); p.Controls.Add(tb2); p.Controls.Add(pb); if (hideAble) { var hideBttn = new Button { Name = "hide" + name, Size = new Size(20, 20), Location = new Point(150, 0), BackgroundImage = (Image)(FOIE.Properties.Resources.eye), BackgroundImageLayout = ImageLayout.Zoom, Tag = "Show", }; hideBttn.Click += (sender, e) => { showHideArea(hideBttn, e); }; new ToolTip().SetToolTip(hideBttn, "Show / hide element"); p.Controls.Add(hideBttn); var zBttn = new Button { Name = "zBttn" + name, Size = new Size(20, 20), Location = new Point(125, 0), BackgroundImage = (Image)(FOIE.Properties.Resources.resize), BackgroundImageLayout = ImageLayout.Zoom, Tag = "Up", }; zBttn.Click += (sender, e) => { changeZLayer(zBttn, e); }; new ToolTip().SetToolTip(zBttn, "Bring to front/ send to back"); p.Controls.Add(zBttn); } if (controlType == "Picture") { var CheckBox = new CheckBox { Name = "cb" + name, Size = new Size(20, 20), Location = new Point(155, 0), Checked = false, AutoCheck = false, Tag = parentName, }; CheckBox.Click += (sender, e) => { showHideImg(CheckBox, e); }; p.Controls.Add(CheckBox); } if (openAble) { var openBttn = new Button { Name = "open" + name, Size = new Size(20, 20), Location = new Point(370, 0), BackgroundImage = (Image)(FOIE.Properties.Resources.folder1), BackgroundImageLayout = ImageLayout.Zoom, }; openBttn.Click += (sender, e) => { changeImg(openBttn, e); }; p.Controls.Add(openBttn); } if (clickAble) { p.Controls.Add(llbl); LinkLabel l = p.Controls.Find("lbl" + name, true).FirstOrDefault() as LinkLabel; l.MouseDown += (sender, e) => panelClickHighlight(l, e); l.MouseUp += (sender, e) => panelClickHighlightOff(l, e); } else { p.Controls.Add(lbl); } Editor.lineCounter++; }