Status Bar does not repaint

Bars for Windows Forms Forum

Posted 17 years ago by Marianne
Version: 2.0.76
Avatar
We are using the status bars quite often and are doing a lot with them i.e. changing background fills, hiding/showing certain status panes, etc.

An issue that we're seeing quite often (and will eventually occur almost every time the app is launched, but is not deterministic because we can't make it happen at will) is that the status bar stops invalidating itself. New text that is added to a pane is written but the old text is not removed so we end up in a situation where layers of text are added over itself. Minimizing/maximizing the application does not change the effect. In fact this normally turns the entire status bar black when it is restored from a minimized state.

I'm guessing that at certain points in the life of the status bar, you're suspending painting (or doing something else that simulates this condition), and for some reason, painting is not resumed. Can you check your code for anything that might cause this behavior? I'm guessing that others aren't seeing this because they may not be using all of the features of the status bar that we are.

In the meantime, I will try to create a sample app that uses the status bar in exactly the same way that our actual application does and hopefully I can repro the results and provide it to you.

------------------------------- Marianne

Comments (6)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Marianne,

I've been trying to resize, click all over, show/hide a panel, etc. but haven't been able to make it happen yet. If you could make a project that shows it, that would be very helpful.

I searched through the StatusBar code and don't see anything that would suspend the painting, although in the WinUICore framework (upon which all our controls are based), there are suspend/resume painting calls during mouse clicks.

If it helps, I can think of several things that might cause this problem you are seeing:

1) As you said, painting that is in suspension. If you can debug while this happens, check the PaintingSuspended property to see if that is set. If it is false then we know that is not the issue.

2) Somehow the renderers not painting. Not sure how this could happen but maybe a measurement or something gets corrupted making the background not draw in the correct location. This is unlikely.

3) Maybe some exception is happening in the painting phase. I've seen controls stop painting when that situation occurs and an exception while painting is raised. Although usually you do get the red X drawing over the control with a stack trace print. Maybe turn on catching exceptions when thrown to see if any fire before this painting issue shows.

I hope those help you get started. Let us know if you find anything using those things or if you get a sample project that can show it.


Actipro Software Support

Posted 17 years ago by Marianne
Avatar
I have sent you an email with qualifying information and screenshots.

------------------------------- Marianne

Posted 17 years ago by Marianne
Avatar
I was able to repro the issue in the sample application by taking the following steps (don't know if every step is required but following this sequence exactly should give you the right results:

-Launch UIStudio sample project in VS 2005
-Open BarForm
-Change the progress bar to marquee style
-Set the progress bar panel visible property to 'False'
-Rebuild the application
-Close VS
-Launch the TestApplication and select the Bar Form application sample
-The right-most pane in the status bar should be the animated icon (prog bar is invisible)
-Set form to normal (non-maximized)
-Add a new text document (So there should be two documents available)
-Set the MDI style to Tabs
-Click back and forth a couple times on the tabs so that you can see the status bar area update with information on line numbers (like going back and forth between 19 lines and 1 line)
-Now just wait... it may take 10 minutes, it may take over an hour, but every 15 minutes or so you should switch tabs back and forth to see if the status area is updating properly or overwriting itself. Eventually you'll notice that it's overwriting and if you minimize/restore at that point the entire status bar area is painted black.

------------------------------- Marianne

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Got it to repro now. If I just let it run for a while it ends up occurring. It seems that the Windows theme drawing code eventually dies. Therefore it's not drawing the themed background. I was able to still draw normally using GDI+ though. I will Google this and see if another workaround can be devised.

Are you using .NET 2.0 or 1.1?


Actipro Software Support

Posted 17 years ago by Marianne
Avatar
.NET 2.0 exclusively.

------------------------------- Marianne

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I did a couple things for this. First it will always draw a GDI+ "control" color background which should get overwritten by the theme. This is only going to be used as a fallback mechanism so the ugly black doesn't show up and all the other contents will still be visible.

Second, for .NET 2.0, the code will now use the VisualStyleRenderer class that Microsoft added in the 2.0 framework to do the theme drawing. Hopefully that will not bug out like the other code can in these certain scenarios.


Actipro Software Support

The latest build of this product (v24.1.0) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.