private void LoadPalette() { SymbolPalette pal = new SymbolPalette(); pal.Name = "ControlNodes"; ButtonAdv btn = new ButtonAdv(); btn.Text = @"Button Node"; btn.UseVisualStyle = true; btn.UseVisualStyleBackColor = true; btn.Office2007ColorScheme = Office2007Theme.Blue; btn.Appearance = ButtonAppearance.Office2007; ControlNode ctrlnode = new ControlNode(btn, new RectangleF(100, 100, 125, 50)); ctrlnode.Name = "Button Node"; pal.AppendChild(ctrlnode); TextBox txtBox = new TextBox(); txtBox.Multiline = true; txtBox.Text = "This is text in a TextBox"; ctrlnode = new ControlNode(txtBox, new RectangleF(100, 100, 140, 50)); ctrlnode.Name = "Text Node"; pal.AppendChild(ctrlnode); // ListBox ctrlnode = new ListBoxControNode(); ctrlnode.Name = "ListBox Node"; pal.AppendChild(ctrlnode); paletteGroupBar1.AddPalette(pal); paletteGroupBar1.FlatLook = true; }
/// <summary> /// Copy constructor. /// </summary> /// <param name="src"></param> public ListBoxControNode(ListBoxControNode src) : base(src) { ListBox lst = this.HostingControl as ListBox; ListBox lstSrc = src.HostingControl as ListBox; string[] itemsarray = new string[lstSrc.Items.Count]; lstSrc.Items.CopyTo(itemsarray, 0); lst.Items.AddRange(itemsarray); }