unit myPanel;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Graphics;
type
TbdStyle = (bdSolid, bdDashed, bdClear, bdDotted);
TGdDirection = (gdHorizontal, gdVertical, gdDiagonal);
type
TmyPanel =
class(TCustomControl)
private
Canvas : TCanvas;
FBgColorFrom : TColor;
FBgColorTo : TColor;
FPaintGradient : Boolean;
FGradientDirection : TGdDirection;
FBorderColor:TColor;
FBorderStyle:TbdStyle;
FBorderWidth:integer;
FRoundEdges:boolean;
FCornerWidth:integer;
{ Private-Deklarationen }
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
{ Public-Deklarationen }
published
property BgColorFrom : TColor
read FBgColorFrom
write FBgColorFrom;
property BgColorTo : TColor
read FBgColorTo
write FBgColorTo;
property PaintGradient : boolean
read FPaintGradient
write FPaintGradient;
property GradientDirection : TGdDirection
read FGradientDirection
write FGradientDirection;
property BorderColor : TColor
read FBorderColor
write FBorderColor;
property BorderStyle : TbdStyle
read FBorderStyle
write FBorderStyle;
property BorderWidth : integer
read FBorderWidth
write FBorderWidth;
property RoundEdges : boolean
read FRoundEdges
write FRoundEdges;
property CornerWidth : integer
read FCornerWidth
write FCornerWidth;
procedure OnPaint;
{ Published-Deklarationen }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Standard', [TmyPanel]);
end;
constructor TmyPanel.Create(AOwner: TComponent);
begin
Canvas := TCanvas.Create;
inherited Create(AOwner);
end;
destructor TmyPanel.Destroy;
begin
inherited;
Canvas.Free;
end;
procedure TmyPanel.OnPaint;
begin
Canvas.Brush.Color := FBgColorFrom;
Canvas.TextOut(1,1,'
Test');
Canvas.Refresh;
end;
end.