So geht es leider auch nicht.
Delphi-Quellcode:
procedure TCsImage.SetPicture(Value: TPicture);
begin
if FPicture <> Value then
begin
FPicture.Assign(Value);
RefreshPicture;
end;
end;
procedure TCsImage.SetHoverPicture(Value: TPicture);
begin
if FHoverPicture <> Value then
FHoverPicture.Assign(Value);
end;
function TCsImage.GetEnabled: Boolean;
begin
Result := inherited Enabled;
end;
procedure TCsImage.SetEnabled(Value: Boolean);
begin
if GetEnabled <> Value then
begin
inherited SetEnabled(Value);
RefreshPicture;
end;
end;
procedure TCsImage.SetDisabledPicture(Value: TPicture);
begin
if FDisabledPicture <> Value then
begin
FDisabledPicture.Assign(Value);
RefreshPicture;
end;
end;
procedure TCsImage.HandleMouseEnter(Sender: TObject);
begin
FDrawHovered := True;
RefreshPicture;
if Assigned(FOnMouseEnter) then
OnMouseEnter(Sender);
end;
procedure TCsImage.HandleMouseLeave(Sender: TObject);
begin
FDrawHovered := False;
RefreshPicture;
if Assigned(FOnMouseLeave) then
OnMouseLeave(Sender);
end;
procedure TCsImage.RefreshPicture;
begin
if (not Enabled) and Assigned(FDisabledPicture) then
inherited Picture.Assign(FDisabledPicture)
else if FDrawHovered and Assigned(FHoverPicture) then
inherited Picture.Assign(FHoverPicture)
else
inherited Picture.Assign(FPicture);
end;
Wo könnte jetzt noch eine Endlosschleife entstehen?