Var
  t_image   : TIMAGE;
begin
  t_image:=timage.Create(self);
  t_image.Canvas.TextOut(10,10,'dsfasd');
  t_image.Picture.LoadFromFile('e:\qw.bmp');
  t_image.Height:=100;
  t_image.Width:=100;
  t_image.top:=self.Height  div 2;
  t_image.left:=self.Width div 2;
  t_image.Visible:=true;
  t_Image.Parent  :=  Form1  ;
  t_image.BringToFront;
  t_image.parent:=panel1;
  t_image.show;
更这个差不多阿

解决方案 »

  1.   

    设置控件的Parent属性为该容器控件即可
      

  2.   

    标准函数:
    //==============================================================================
    //动态创建控件******************************************************************
    //==============================================================================
    function DynaCreateComponent(Owner: TComponent; CompType: TControlClass; CompName: String; Left,Top,Width,Height:Integer): TControl;
    begin
      if (Owner.FindComponent(CompName)<>nil) and not(Owner.FindComponent(CompName) is TControl) then
      begin
        Result := nil;
        exit;
      end;
      Result := Owner.FindComponent(CompName) as TControl;
      if Result=nil then
      begin
        Result := CompType.Create(Owner);
        with Result do
        begin
          if Owner is TwinControl then
          begin
            SetBounds(Left,Top,Width,Height);
            Parent := TwinControl(Owner);{如果是可视构件,则显示之}
            if Owner is TForm then TForm(Owner).ActiveControl := TWinControl(Result);{设置窗口焦点}
          end;
        end;
        Result.Name := CompName;
      end
      else {Result<>Nil}
      if not(Result is CompType) then
      begin
        Result := nil;
        Exit;
      end;
      Result.Visible := True;
    end;
    { 对于未知数量的控件组,利用TList
      var ControlList: Tlist; CreateNum: integer;
      const CreateClass : TControlClass = TButton;//可以任意修改TControlClass = TEdit或TPanel等。效果一样。
      var i:integer; APoint: Pointer;
      ControlList := TList.Create;
      ControlList.Clear;
      CreateNum := 10;
      for i:=1 to CreateNum do
          begin
            APoint := Pointer(DynaCreateComponent(self,CreateClass,'Button_' + IntToStr(i),0,i*20+1,60,20));//创建
            ControlList.Add(APoint);
          end;
      TButton(ControlList.Items[i]).Caption := 'XXXX';}