在同一个StatusStrip中添加多个文本
private void Form1_Load(object sender, EventArgs e)
{
StatusStrip ss=new StatusStrip();
ToolStripStatusLabel[] tssl;
tssl[0]=new ToolStripStatusLabel();
tssl[1]=new ToolStripStatusLabel();
tssl[0].Text = "first";
tssl[1].Text = "second"; ss.Items.AddRange(tssl);
this.Controls.Add(ss);
}
有错误。。
private void Form1_Load(object sender, EventArgs e)
{
StatusStrip ss=new StatusStrip();
ToolStripStatusLabel[] tssl;
tssl[0]=new ToolStripStatusLabel();
tssl[1]=new ToolStripStatusLabel();
tssl[0].Text = "first";
tssl[1].Text = "second"; ss.Items.AddRange(tssl);
this.Controls.Add(ss);
}
有错误。。
ToolStripStatusLabel[] tssl = new ToolStripStatusLabel[2]; //<--
tssl[0] = new ToolStripStatusLabel();
tssl[1] = new ToolStripStatusLabel();tssl[0].Text = "first";
tssl[1].Text = "second";ss.Items.AddRange(tssl);
this.Controls.Add(ss);
statusStrip1.Dock = System.Windows.Forms.DockStyle.Top;
statusStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Visible;
statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
toolStripStatusLabel1});
statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
statusStrip1.Location = new System.Drawing.Point(0, 0);
statusStrip1.Name = "statusStrip1";
statusStrip1.ShowItemToolTips = true;
statusStrip1.Size = new System.Drawing.Size(292, 22);
statusStrip1.SizingGrip = false;
statusStrip1.Stretch = false;
statusStrip1.TabIndex = 0;
statusStrip1.Text = "statusStrip1";ToolStripStatusLabel[] tssl;
tssl[0]=new ToolStripStatusLabel();
tssl[1]=new ToolStripStatusLabel();
tssl[0].Text = "first";
tssl[1].Text = "second"; ss.Items.AddRange(tssl);
this.Controls.Add(ss);