Otiel
Otiel

Reputation: 18743

Panel in StatusStrip?

Is it possible to have a panel in a StatusStrip? MSDN is kind of saying so:

The default StatusStrip has no panels. To add panels to a StatusStrip, use the ToolStripItemCollection.AddRange method [...]

... but I can't find how.

I tried to add a Panel or a ToolStripPanel to a StatusStrip, but it is only accepting ToolStripItems. On the other hand, I tried adding a ToolStripItem to a Panel or a ToolStripPanel, but both only accepts Controls:

ToolStripPanel toolStripPanel = new ToolStripPanel();
toolStripPanel.Controls.Add(toolStripStatusLabel);   // Wrong
statusStrip.Items.AddRange(toolStripPanel);          // Wrong again

Upvotes: 0

Views: 2075

Answers (2)

Innocent
Innocent

Reputation: 1

You can use the ToolStripStatusLabel. In order to have the look and feel of a Panel, simply set the following properties of the ToolStripStatusLabel: BorderSides = All, BorderStyle = SunkenOuter

Upvotes: 0

Victor Zakharov
Victor Zakharov

Reputation: 26424

What's interesting is that in Microsoft terms

ToolStripStatusLabel - Represents a panel in a StatusStrip control.

So their panel is really a Label. Unless that's a mistake in their documentation, what you are trying to do is impossible, as there is no Panel class that can be hosted inside StatusStrip.

Upvotes: 1

Related Questions