Jump to content
Sign in to follow this  
dexto

GDI+ flickering problem

Recommended Posts

dexto

My application has a loop that refreshes every second.

while true
    _GDIPlus_GraphicsClear($GDI_Buffer)
    _GDIPlus_GraphicsDrawStringEx($GDI_Buffer, $time, $hFont, $tLayout, $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawStringEx($GDI_Buffer, $weather, $dFont, $wLayout, $hFormat, $hBrush)
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
sleep(1000)
wend

It seems from time to time whole window becomes black for a second and then comes back. What did I do wrong?

Thx guys, any suggestions are welcome.. I'm lost here.

Share this post


Link to post
Share on other sites
dexto

Thx Andreik,

It helps and I'm using it but its not entirely illuminating the flickering...

Turns out GDI+ has a flickering problem no way around it. I think is not designed for frame based applications may be nice GUI at most.

For some reason from time to time Windows clears GDI+ to black until redrawn..? :S

Share this post


Link to post
Share on other sites
monoceres

Turns out GDI+ has a flickering problem no way around it. I think is not designed for frame based applications may be nice GUI at most.

For some reason from time to time Windows clears GDI+ to black until redrawn..? :S

There will be small flicker when redrawing the screen yes, it's because GDI+ is a slow sob when it comes to drawing images.

The window can also turn black when windows invalidates the window rect, this can happen if another windows covers your window. This happens mostly on systems <Vista.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
dexto

The window can also turn black when windows invalidates the window rect, this can happen if another windows covers your window. This happens mostly on systems <Vista.

I noticed that with the window!!!

For some apps even when you move you mouse fast over it it seem to work much faster!

I was always wondering why.

Edited by dexto

Share this post


Link to post
Share on other sites
Yashied
dexto

Its MUCH better now! Thx! The post above has some additional tricks that improve even farther.

Edited by dexto

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×