public void AddProperty(PropertyField f) { tlp.RowCount++; // property name Label label = new Label(); label.Text = f.name; label.Margin = new Padding(1, 4, 0, 0); currentGroup.Controls.Add(label); // specific types if (f.type == PropertyField.Type.SliderProperty) { SliderProperty sp = (SliderProperty)f; currentGroup.Controls.Add(sp.sc); currentGroup.RowStyles.Add(new RowStyle(SizeType.Absolute, 22)); currentGroup.Height += 23; } if (f.type == PropertyField.Type.EnumProperty) { EnumProperty ep = (EnumProperty)f; currentGroup.Controls.Add(ep.sc); currentGroup.RowStyles.Add(new RowStyle(SizeType.Absolute, 22)); currentGroup.Height += 23; } }
public void AddProperty(SelectedType selectedType, string selectedName, PropertyField[] pfs) { ClearProperties(); // set header if (selectedType == SelectedType.None) { selectedTypeImage.Image = System.Drawing.Image.FromFile("Thumbs/nothing.png"); } if (selectedType == SelectedType.Tool) { selectedTypeImage.Image = System.Drawing.Image.FromFile("Thumbs/tool.png"); } if (selectedType == SelectedType.Object) { selectedTypeImage.Image = System.Drawing.Image.FromFile("Thumbs/object.png"); } selectedTypeText.Text = selectedName; // add properties int height = 0; foreach (PropertyField f in pfs) { tlp.RowCount++; // property name Label label = new Label(); label.Text = f.name; label.Margin = new Padding(1, 4, 0, 0); tlp.Controls.Add(label); // specific types if (f.type == PropertyField.Type.SliderProperty) { SliderProperty sp = (SliderProperty)f; tlp.Controls.Add(sp.sc); tlp.RowStyles.Add(new RowStyle(SizeType.Absolute, 22)); height += 23; } if (f.type == PropertyField.Type.EnumProperty) { EnumProperty ep = (EnumProperty)f; tlp.Controls.Add(ep.sc); tlp.RowStyles.Add(new RowStyle(SizeType.Absolute, 22)); height += 23; } } tlp.Height = height + 1; }