I need to add a set of custom ToolStripItem
(containing the additional property formReference
) to a ToolStripPanel
but they won't appear for some reason.
Code for adding the items:
foreach (Form form in Application.OpenForms)
if (form.Name != "MainForm")
{
myToolStripItem mtsi = new myToolStripItem(form.Text, null, open_form);
mtsi.formReference = form;
tspTaskBar.Items.Add(mtsi);
}
myToolStripItem:
public class myToolStripItem : ToolStripItem
{
public object formReference { get; set; }
public myToolStripItem(string text, System.Drawing.Image image, EventHandler onClick)
: base(text,image,onClick) { }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
}
}
Can you please point me to what I'm doing wrong? Thank you.