VLabelMichel.Parent := self;
VLabelMichel.Parent := self;
unit Unit29; interface uses SysUtils, Classes, Graphics, StdCtrls, ExtCtrls; type TMichelImage = class(TImage) private fLabel : TLabel; procedure SetLabel(const Value: TLabel); protected procedure DoPictureChange(Sender: TObject); published property ImageLabel : TLabel read fLabel write SetLabel; public constructor Create(aOwner: TComponent); override; destructor Destroy; override; end; implementation { TmImage } constructor TMichelImage.Create(aOwner: TComponent); begin inherited; fLabel := TLabel.Create(Self); fLabel.Parent := Self; fLabel.Left := 5; fLabel.Top := 5; fLabel.Caption := '0 x 0'; Picture.OnChange := DoPictureChange; end; destructor TMichelImage.Destroy; begin fLabel.Free; inherited; end; procedure TMichelImage.DoPictureChange(Sender: TObject); begin fLabel.Caption := format('%d x %d',[Picture.Width, Picture.Height]); end; procedure TMichelImage.SetLabel(const Value: TLabel); begin if assigned(Value) then fLabel.Assign(Value); end; end.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionVLabelMichel.Parent := TWinControl(self);
Label.Create(nil)