You cannot place controls into a StatusBar control in the Designer. However, you can add any number of controls to the StatusBar programmatically through it’s ‘Controls’ property. After adding the controls, set their Visible, Location, Bounds and other properties.
Here’s a sample method that could be called in a form’s constructor after the ’InitializeComponent’.
[C#]
private void AddStatusBarControls(StatusBar sb)
{
ProgressBar pb = new ProgressBar();
sb.Controls.Add(pb);
pb.Visible = true;
pb.Bounds = new Rectangle(sb.Width / 4, 4, sb.Width / 2, sb.Height - 8);
pb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
}
Share with