Reputation: 2496
Does anyone have idea how to add picturebox to toolstripcontainer.toptoolstrippanel? I got warning message: Warning: Controls added to this collection must be of type 'ToolStrip'.
Upvotes: 0
Views: 1027
Reputation: 1039538
As the error message indicates you can add only a ToolStrip
instances to the TopToolStripPanel
. On the other hand you could add the PictureBox image to the Items property of a ToolStrip
:
var pb = new PictureBox();
pb.Load(@"c:\work\foo.png");
var ts = new ToolStrip();
ts.Items.Add(pb.Image);
toolStripContainer1.TopToolStripPanel.Controls.Add(ts);
Upvotes: 2