.NET Controls Constructed Off-Screen Display Black

ToolStripStatusLabel Goes BlackWhile working on Duplicate Photo Finder, I discovered a very odd thing: the ToolStripStatusLabel displays solid black if it is constructed off-screen, and it cannot be recovered. You can see in the upper-right screenshot how the labels are solid black.

I suppose that it would be possible to entirely construct a new control then replace the “old” one, but that’s a bit of a pain.

Instead, you can make certain that the form is drawn inside of the screen’s view port (on the monitor) by setting the Form.StartPosition to Manual and the Form.Location to 0, 0 (the upper left corner of the screen). i.e.

this.StartPosition = FormStartPosition.Manual

It’s better to set it in the designer though.

It’s interesting that it doesn’t affect the entire StatusStrip or the ToolStripProgressBars. Not sure why, and not too worried about it. Got the solution. Happy with that. 🙂

I spent a bit of time searching for an answer and never found one or anything remotely related. Hopefully this will help someone.

Share

Written by:

276 Posts

View All Posts
Follow Me :

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

One thought on “.NET Controls Constructed Off-Screen Display Black

  1. Just before you set the label text for the toolStripStatusLabel1.text

    call Application::DoEvents();

    This must solve the problem
    🙂