Board index » cppbuilder » Re: How to avoid flicker

Re: How to avoid flicker


2006-06-09 10:50:30 PM
cppbuilder92
Azrin Aris < XXXX@XXXXX.COM >wrote:
Quote

[...] when I resize the component the Image flickers. [...]

void __fastcall TGeoImage::Paint(void)
{
if(FImage)
{
Canvas->Draw(0,0,FImage);
}
}
Use CopyRect instead of Draw.
~ JD
 
 

Re:Re: How to avoid flicker

Azrin Aris wrote:
Quote
I'm writing a component from TGraphicControl to show part of a big JPG
image file. My first problem is when I resize the component the Image
flickers.
Did you try setting the form property DoubleBuffered to true and/or
setting your TImage Stretch property to true?
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
www.leunen.com/
----------------------------------------
 

Re:Re: How to avoid flicker

Michel Leunen wrote:
Quote
Azrin Aris wrote:

>I'm writing a component from TGraphicControl to show part of a big JPG
>image file. My first problem is when I resize the component the Image
>flickers.

Did you try setting the form property DoubleBuffered to true and/or
setting your TImage Stretch property to true?

Michel
Hi Michel,
After I set the Main Form DoubleBuffered to true, the flicker gone. But
I'm writing a component and is there a way to avoid flicker
programatically from the component itself?
Azrin
 

{smallsort}

Re:Re: How to avoid flicker

Azrin Aris wrote:
Quote
After I set the Main Form DoubleBuffered to true, the flicker gone. But
I'm writing a component and is there a way to avoid flicker
programatically from the component itself?
Descendants from TGraphicControl have a Parent property which you could
use to test if it's a TForm descendant. But IMO, it'd be far better if
you could provide a component flicker free by its own and implement
double-buffering yourself. Just draw on the canvas of a in-memory bitmap
and when you are done, copy your bitmap to your canvas using BitBlt().
Do a search on google, there were many posts related to double-buffering
or flickering.
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
www.leunen.com/
----------------------------------------
 

Re:Re: How to avoid flicker

Michel Leunen wrote:
Quote
Azrin Aris wrote:

>After I set the Main Form DoubleBuffered to true, the flicker gone.
>But I'm writing a component and is there a way to avoid flicker
>programatically from the component itself?

Descendants from TGraphicControl have a Parent property which you could
use to test if it's a TForm descendant. But IMO, it'd be far better if
you could provide a component flicker free by its own and implement
double-buffering yourself. Just draw on the canvas of a in-memory bitmap
and when you are done, copy your bitmap to your canvas using BitBlt().
Do a search on google, there were many posts related to double-buffering
or flickering.

Michel
Thanks Michel, I'll try the BitBlt method.
Azrin