BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Transparent form problem with flicker

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
jamesa
Guest





PostPosted: Fri Mar 04, 2005 1:36 pm    Post subject: Transparent form problem with flicker Reply with quote



I intercepted onPaint event to draw in the form surface. I use
offscreen buffer to avoid flicker.

But why if I set the form to transparent (TransparentColor := TRUE),
the flicker occured ?

Is this normal? That something I must live with?

I need to use transparent form, but I dont want flicker.

Any idea for workaround ?


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
OffScreen: TBitmap;
BG: TBitmap;
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Color := clMaroon;
Form1.TransparentColorValue := clMaroon;
Form1.TransparentColor := TRUE;

OffScreen := TBitmap.Create;
OffScreen.Width := Form1.ClientWidth;
OffScreen.Height := Form1.ClientHeight;

BG := TBitmap.Create;
BG.LoadFromFile('BG.bmp');
end;

procedure TForm1.FormPaint(Sender: TObject);
var
x, y: integer;
begin
// Draw something in the off screen buffer
y := 0;
While y < ClientHeight DO
Begin
x := 0;
While x < ClientWidth Do
Begin
BitBlt(OffScreen.Canvas.Handle, x, y, BG.Width, BG.Height,
BG.Canvas.Handle, 0, 0, SRCCOPY);
Inc (x, BG.Width);
End;
Inc (y, BG.Height);
// This sleep is to see the flicker
Sleep(300);
End;

// copy it into form surface
BitBlt(Canvas.Handle, 0, 0, ClientWidth, ClientHeight,
OffScreen.Canvas.Handle, 0, 0, SRCCOPY);
end;

end.


Back to top
Oisin
Guest





PostPosted: Fri Mar 18, 2005 10:00 am    Post subject: Re: Transparent form problem with flicker Reply with quote



[email]meerkapot (AT) yahoo-dot-com (DOT) no-spam.inva[/email]lid (jamesa) wrote in message news:<42286467$1 (AT) newsgroups (DOT) borland.com>...
Quote:
But why if I set the form to transparent (TransparentColor := TRUE),
the flicker occured

Hello,

I'm having the same Problem. Just creating a new projekt with one form
and setting TransparentColor to true causes the form to flicker when
it starts up. Is there any solution to this?

Oisín

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.