In a desktop application I have a label, background = Transparant, on top of a colored rectangle.
The text of the label is not static but from the database and to get extra attention this text needs to blink.
Label1.Visible = label1.Visible xor true
Quite simple. On OS X this works fine, no issue, on Windows the user sees an annoying repainting of the label, getting to transparant at the very last moment of the painting.
I tried to set / clear the .text property instead of the .visible, but it’s the same.
Since the label-control has no property to set the ‘background-color’ the same colored background, it seems I cannot solve that quite easy. So I am looking for a trick to solve this issue and hope someone has can hint me.
I agree with Michel. Use a Canvas. Layering controls like this is generally a bad idea and leads to severe flickering if the window is moved or resized.
Tested … doesn’t work satisfactory either. Worse than using the .visible property.
Going to setup blinking label within a canvas and will post result here.
Having a complex GUI it’s obvious to work with containercontrols within containercontrols etc. Don’t know how to do rapid GUI development without this technique. So far it works for me, except using the Groupbox control, shapes etc. , which results in flickering with MS Windows.
Maybe you can freeze redrawing with a WM_SETREDRAW message, and force all the drawing to happen at once?
(This is what invalidate is supposed to do really, you set invalidate on things that need repainting and Windows will do it when it gets around to it)
[quote]In a desktop application I have a label, background = Transparant, on top of a colored rectangle.
The text of the label is not static but from the database and to get extra attention this text needs to blink.[/quote]
How about changing the label for a simple .drawstring call in the paint event?