tags:

views:

130

answers:

2

I have 4 continus ToolStripStatusLabel in statusStrip and their is a space between them, the requirement is like that we dont need any space between these 4 ToolStripStatusLabel in statusStrip.

Please tell me how can we remove space between them.. i have got an alternative to set all values in one statusStrip but as all values are coming from various sources so its a major change. so please provide me solution ( i am using c#.net - vs2005)

+2  A: 

You can change the margin-property of the ToolStripStatusLabels, even to negative numbers: For example, try '-2; 3; -2; 2', this will make the items get closer together. Watch out not to go too close, to avoid overlapping.

To clarify, what property I mean, some sample code (designer generated):

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        this.statusStrip1 = new System.Windows.Forms.StatusStrip();
        this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
        this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
        this.statusStrip1.SuspendLayout();
        this.SuspendLayout();
        // 
        // statusStrip1
        // 
        this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.toolStripStatusLabel1,
        this.toolStripStatusLabel2});
        this.statusStrip1.Location = new System.Drawing.Point(0, 240);
        this.statusStrip1.Name = "statusStrip1";
        this.statusStrip1.Size = new System.Drawing.Size(284, 22);
        this.statusStrip1.TabIndex = 0;
        this.statusStrip1.Text = "statusStrip1";
        // 
        // toolStripStatusLabel1
        // 
        this.toolStripStatusLabel1.Margin = new System.Windows.Forms.Padding(-3, 3, -3, 2);
        this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
        this.toolStripStatusLabel1.Size = new System.Drawing.Size(25, 17);
        this.toolStripStatusLabel1.Text = "123";
        // 
        // toolStripStatusLabel2
        // 
        this.toolStripStatusLabel2.Margin = new System.Windows.Forms.Padding(-3, 3, -3, 2);
        this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
        this.toolStripStatusLabel2.Size = new System.Drawing.Size(25, 17);
        this.toolStripStatusLabel2.Text = "234";
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(284, 262);
        this.Controls.Add(this.statusStrip1);
        this.Name = "Form1";
        this.Text = "Form1";
        this.statusStrip1.ResumeLayout(false);
        this.statusStrip1.PerformLayout();
        this.ResumeLayout(false);
        this.PerformLayout();

    }
Simpzon
+1  A: 

Try to set the left and right Margin of your ToolStripStatusLabels to a negative value. You'll just have to experiment a bit to see what exact value gives you the position you are looking for.

Nailuj
Wow, that was close.
Simpzon