views:

336

answers:

2

I've got a StatusStrip with a single ToolStripStatusLabel, Spring=true and a background color for notifications.

The problem is that there's an ugly gray square on the right side of the status strip. After fiddling for a while, I realized this is the sizing grip (I had is set to SizingGrip=false, GripStyle=Hidden). Yet even with it hidden, it still hogs the space. I can't get any content on the status strip to extend all the way to the right.

How would you work around this? Note I can't just set the backcolor of the StatusStrip because the Status Label changes colors and has some fading effects.

+1  A: 

Have a look at this blog entry on MSDN. The question was about changing the size of the sizing grip manually, and I think using the ToolStrip Renderer as suggested could work for you also.

The problem I have so far, is that it removes the background color on a status label in the StatusStrip, so it's not a solution yet, but it's a start.

    public MyForm()
    {
        InitializeComponent();
        statusStrip1.Renderer = new MyRenderer();
    }

    private class MyRenderer : ToolStripProfessionalRenderer
    {
        protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
        {
            // don't draw at all
        }
    }
JYelton
That's not my blog :)
Hans Passant
Hi Hans! If you mean the code in my post, no, I modified it a bit. Admittedly not sufficient to fix the problem.
JYelton
+2  A: 

The StatusStrip.Padding property is borked, it returns the wrong value for Padding.Right if the sizing grip is disabled. You can fix it in your form constructor, like this:

public Form1() {
  InitializeComponent();
  statusStrip1.Padding = new Padding(statusStrip1.Padding.Left,
    statusStrip1.Padding.Top, statusStrip1.Padding.Left, statusStrip1.Padding.Bottom);
}

Using the Left property to specify Right is the fix. Don't bother submitting this bug to Connect, they won't fix it.

Hans Passant
+1 this works; and thanks for the explanation
JYelton