Хочу добавить свойство Kind в компонент
(изменение ориентации компонента), делаю так:
type
TKind = (Book, Album);
. . .
TMLImage = class(TImage)
private
fKind: TKind;
procedure SetKind(const AValue: TKind);
protected
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Kind: TKind read fKind write SetKind;
end;
. . .
implementation
procedure TMLImage.SetKind(const AValue: TKind);
var
Knd: TPoint;
begin
Knd := Point(Width, Height);
if AValue = Book then begin
Height := Knd.Y;
Width := Knd.X;
end;
if AValue = Album then begin
Height := Knd.X;
Width := Knd.Y;
end;
fKind := AValue;
invalidate;
end;
procedure TMLImage.Paint;
begin
inherited Paint;
end;
constructor TMLImage.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fFormat.Height := 150;
fFormat.Width := 100;
//fKind := Book;
SetKind(Book);
end;
destructor TMLImage.Destroy;
begin
inherited Destroy;
end;
Отрабатывает только при изменении Kind с Book на Album,
что я делаю не так?