I think you did everything correct except now you need to also set the parent 
property.

Image_New.Parent := Form1;

Something like that.

Robert

--- In [email protected], "totallyfreeenergy" <totallyfreeene...@...> 
wrote:
>
> I was wondering how to create VCL components dynamically. For example
> procedure TForm1.Image1DblClick(Sender: TObject);
> var
>  Image_New : TImage;
>  abutton : TButton;
> begin
> //  FSpell.Image_s1.Picture := FSpell.Image1.Picture;
>   Image_New := TImage.Create(Form1);
>   Image_New.Left := 8;
>   Image_New.Top := 222;
>   Image_New.Visible := true;
>   Image_New.Width := 60;
>   Image_New.Height := 60;
>  // Image_New.Create(Form1);
>   Image_New.Picture := Form1.Image1.Picture;
>   abutton := TButton.Create(Form1);
>   abutton.Left := 8;
>   abutton.Top := 250;
>   abutton.Caption := 'My New Button';
>   abutton.Width := 120;
>   abutton.Height := 40;
> end;
> This code compiled ok. It had no problems creating Image_New. However the 
> Image_New and abutton are not there on the form. Obviously it is not created 
> although it gave no indication and did not crash while executing this code. 
> 
> Regards
> TFE
> http://totallyfreeenergy.zxq.net
>


Reply via email to