dotnetmonitor.com |
|
||||||||||||
Spring is supported only in StatusStrip and only
with StatusStripLabels. It utilizes the underlying Table layout with a columnstyle
set to percentage to achieve the effect of the Spring panel filling the remaining
space. Multiple ToolStripPanels set to Spring are sized equally, sharing the remaining
space equally.
Sampleclass Form4 : Form { ToolStripStatusLabel middleLabel;
public Form4() { // new StatusStrip StatusStrip ss = new StatusStrip();
// add left label ss.Items.Add("Left");
// handle middle label separately middleLabel = new ToolStripStatusLabel("Middle (Spring)"); middleLabel.Click += new EventHandler(middleLabel_Click); ss.Items.Add(middleLabel);
// add right label ss.Items.Add("Right");
// Add the statusStrip to the controls collection this.Controls.Add(ss); }
void middleLabel_Click(object sender, EventArgs e) { if (middleLabel.Spring) { middleLabel.Spring = false; middleLabel.Text = "Middle (Spring - False)"; } else { middleLabel.Spring = true; middleLabel.Text = "Middle (Spring - True)"; } } } |
||||||||||||
|
||||||||||||