Wie kann ich verhindern das mein eigener
VCL Komponent flackert (z.b wenn align auf alclient gesetzt ist kommt es zum flackern beim resizen der form) Hier ein beispielcode:
Delphi-Quellcode:
unit VistaBar;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls,VisualCommon;
type
TVistaBar =
class(TGraphicControl)
private
FOnPaint: TNotifyEvent;
property Canvas;
protected
procedure Paint;
override;
public
constructor Create(AOwner: TComponent);
override;
published
property Align;
property Anchors;
property DragCursor;
property Visible;
property OnClick;
property OnDblClick;
property OnMouseActivate;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
visual soft', [TVistaBar]);
end;
constructor TVistaBar.Create(AOwner: TComponent);
var
i:integer;
begin
inherited Create(AOwner);
Width := 100;
Height := 20;
end;
procedure TVistaBar.Paint;
var
r:trect;
begin
r.left:=0;
r.Right:=width;
r.Top:=0;
r.Bottom:=height;
with Canvas
do
begin
canvas.Brush.Color:=clred;
canvas.Pen.Color:=clblack;
canvas.FillRect(r);
end;
if Assigned(FOnPaint)
then FOnPaint(Self);
end;
end.
Danke für eure Antworten!