Article View: borland.public.cppbuilder.nativeapi
Article #4558Animation with TThread in non client area (border form)
From: Carlos
Date: Mon, 09 Jan 2006 17:17
Date: Mon, 09 Jan 2006 17:17
66 lines
2708 bytes
2708 bytes
Hello how could I paint a image series (for create animation) in non client
area (border form)
without flickering ?
I created an animation with TThread class. It works but with flickering
(any)
class TAnimationThread : public TThread
{
private:
int FSpeed;
protected:
void __fastcall Execute()
{
int i = 0;
int nDir;
FreeOnTerminate = true;
while ( ! Terminated )
{
if ( ! FormMain->TimerProgressBar->Enabled )
i = 0;
TCanvas *pCanvas = new TCanvas;
pCanvas->Handle = GetWindowDC( FormMain->Handle );
// output the caption string
int pMode = SetBkMode( pCanvas->Handle, TRANSPARENT );
Graphics::TBitmap * pBitmap = new Graphics::TBitmap();
FormMain->ImageListAnimate->GetBitmap(i, pBitmap);
pCanvas->Draw(FormMain->Width - pBitmap->Width - 2, 2, pBitmap);
//SetBkMode( pCanvas->Handle, pMode );
ReleaseDC( FormMain->Handle, pCanvas->Handle );
delete pBitmap;
pCanvas->Handle = NULL;
delete pCanvas;
if ( i == 8 )
nDir = -1;
else
if ( i == 0 )
nDir = 1;
i += nDir;
Sleep(FSpeed);
if ( ! FormMain->TimerProgressBar->Enabled )
{
i = 0;
Terminate();
}
}
}
public:
__fastcall TAnimationThread(bool
CreateSuspended):TThread(CreateSuspended)
{
}
__fastcall TAnimationThread(int nSpeed):TThread(false)
{
FSpeed = nSpeed;
Priority = tpHighest;
}
};
Technical Details
Message-ID:
<43c29a01@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7abd13b8dc24dd8a,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Carlos" <a@a.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Animation with TThread in non client area (border form) Date: Mon, 9 Jan 2006 18:17:01 +0100 Lines: 68 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 80.38.17.40 Message-ID: <43c29a01@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1136826881 80.38.17.40 (9 Jan 2006 09:14:41 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail