git-svn-id: trunk@16503 -
This commit is contained in:
paul 2008-09-09 14:10:56 +00:00
parent b8949b9c21
commit f67b637d75
2 changed files with 23 additions and 22 deletions

View File

@ -561,10 +561,10 @@ type
FUseParentCanvas: boolean; FUseParentCanvas: boolean;
function GetCanvas: TCanvas; function GetCanvas: TCanvas;
procedure SetPicture(const AValue: TPicture); procedure SetPicture(const AValue: TPicture);
procedure SetCenter(Value : Boolean); procedure SetCenter(const AValue : Boolean);
procedure SetProportional(const AValue: Boolean); procedure SetProportional(const AValue: Boolean);
procedure SetStretch(Value : Boolean); procedure SetStretch(const AValue : Boolean);
procedure SetTransparent(Value : Boolean); procedure SetTransparent(const AValue : Boolean);
protected protected
procedure PictureChanged(Sender : TObject); virtual; procedure PictureChanged(Sender : TObject); virtual;
function DestRect: TRect; virtual; function DestRect: TRect; virtual;
@ -575,7 +575,7 @@ type
procedure DoAutoSize; override; procedure DoAutoSize; override;
procedure Paint; override; procedure Paint; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
property Canvas: TCanvas read GetCanvas; property Canvas: TCanvas read GetCanvas;
public public
@ -589,9 +589,9 @@ type
property OnMouseDown; property OnMouseDown;
property OnMouseMove; property OnMouseMove;
property OnMouseUp; property OnMouseUp;
property Stretch: Boolean read FStretch write SetStretch; property Stretch: Boolean read FStretch write SetStretch default False;
property Transparent: Boolean read FTransparent write SetTransparent default false; property Transparent: Boolean read FTransparent write SetTransparent default False;
property Proportional: Boolean read FProportional write SetProportional default false; property Proportional: Boolean read FProportional write SetProportional default False;
end; end;

View File

@ -16,18 +16,19 @@
***************************************************************************** *****************************************************************************
} }
constructor TCustomImage.Create(TheOwner: TComponent); constructor TCustomImage.Create(AOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(AOwner);
ControlStyle:= [csCaptureMouse, csClickEvents, csDoubleClicks]; ControlStyle:= [csCaptureMouse, csClickEvents, csDoubleClicks];
AutoSize := False; AutoSize := False;
FCenter := False; FCenter := False;
FProportional := False;
FStretch := False; FStretch := False;
FTransparent := False; FTransparent := False;
FPicture := TPicture.Create; FPicture := TPicture.Create;
FPicture.OnChange := @PictureChanged; FPicture.OnChange := @PictureChanged;
FUseParentCanvas := false; FUseParentCanvas := False;
SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y); SetInitialBounds(0, 0, GetControlClassDefaultSize.X, GetControlClassDefaultSize.Y);
end; end;
destructor TCustomImage.Destroy; destructor TCustomImage.Destroy;
@ -112,33 +113,33 @@ begin
end; end;
end; end;
procedure TCustomImage.SetStretch(Value : Boolean); procedure TCustomImage.SetStretch(const AValue : Boolean);
begin begin
if FStretch=Value then exit; if FStretch = AValue then exit;
FStretch := Value; FStretch := AValue;
PictureChanged(Self); PictureChanged(Self);
end; end;
procedure TCustomImage.SetTransparent(Value : Boolean); procedure TCustomImage.SetTransparent(const AValue : Boolean);
begin begin
if FTransparent=Value then exit; if FTransparent = AValue then exit;
FTransparent := Value; FTransparent := AValue;
if (FPicture.Graphic <> nil) and (FPicture.Graphic.Transparent <> FTransparent) if (FPicture.Graphic <> nil) and (FPicture.Graphic.Transparent <> FTransparent)
then FPicture.Graphic.Transparent := FTransparent then FPicture.Graphic.Transparent := FTransparent
else PictureChanged(Self); else PictureChanged(Self);
end; end;
procedure TCustomImage.SetCenter(Value : Boolean); procedure TCustomImage.SetCenter(const AValue : Boolean);
begin begin
if FCenter=Value then exit; if FCenter = AValue then exit;
FCenter := Value; FCenter := AValue;
PictureChanged(Self); PictureChanged(Self);
end; end;
procedure TCustomImage.SetProportional(const AValue: Boolean); procedure TCustomImage.SetProportional(const AValue: Boolean);
begin begin
if FProportional=AValue then exit; if FProportional = AValue then exit;
FProportional:=AValue; FProportional := AValue;
PictureChanged(Self); PictureChanged(Self);
end; end;