ToolStripStatusLabel is not displayed after the window be restored(after minimize)

1k Views Asked by At

I have a simple StatusStrip with one ToolStripStatusLabel in it. Text in label can be quite long, so I have prefered to display it cutted.
I have set ToolStripStatusLabel properties: Spring=true and TextAlign=MiddleLeft. I didn't want to set StatusStrip's property LayoutStyle = ToolStripLayoutStyle.Flow, because with ToolStripLayoutStyle.Flow the Text will be overridden with triangle(for resizing).enter image description here

The Text property is set directly after InitializeComonents() and is displayed as expected - cutted.
If I do minimize(to taskbar) and then restore the window, the text will not be displayed at all. If I make window wider I can see the text, and if I bring the window to the initial size I still can see the text, cutted as expected.

I have and will post my solution, but I would ask you, whether you have any elegant one?

1

There are 1 best solutions below

0
On BEST ANSWER

The solution I have found is quite simple. Just handle the window's restore event(there is no such event, but there is a workaround: Is there an event raised in C# when a window is restored?) and reset the text in ToolStripStatusLabel:

var txt = tslabel.Text;
tslabel.Text = " ";
tslabel.Text = txt;