Mattias Gaertner wrote:
To avoid flickering:
Create a descendent of TCustomControl, call Invalidate and
Application.ProcessMessages, in Paint draw to a bitmap and draw the bitmap
to the canvas.
I tryed to create a TCustomControl descendent, but I can't seam to see
it on the screen no matter what I do ...
Can anyone help me (again)?
Here is how I create it:
procedure TfrmPrincipal.FormCreate(Sender: TObject);
begin
Tela := TTela.Create(Self);
Tela.Height := 400;
Tela.Width := 500;
Tela.Left := 0;
Tela.Top := 0;
Tela.OnPaint := @DesenharRetas; // DesenharRetas is a painting
TNotifyEvent. It doesn't matter if it is here.
Tela.Visible := True;
// Tela.Invalidate; or Tela.RePaint; neither work
end;
And here is how it is defined:
TTela = class(TCustomControl)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Paint; override;
end;
implementation
procedure TTela.Paint;
var
x, y: Integer;
begin
// Limpa a tela
Canvas.Pen.Color := clWhite;
Canvas.Rectangle(0, 0, Width, Height);
// Desenha os quadrados
Canvas.Pen.Color := clBlack;
for x := 1 to 8 do
for y := 1 to 8 do
Canvas.Rectangle(Round((x - 1) * Width / 8), Round((y - 1) * Height
/ 8),
Round(x * Width / 8), Round(y * Height / 8));
inherited Paint;
end;
I also tryed inheriting from TGraphicalComponent or something like that.
thanks,
Felipe
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives