代码如下:
procedure CreateControl(Tselfcontrol:TWinControl:EdLeft,EdTop:Integer;Parent:TWinControl);
var selfcontrol: Tselfcontrol;//系统提示:Constant or type identifier expected
begin
  selfcontrol := Tselfcontrol.Create(self);
  selfcontrol.Top := EdTop;
  selfcontrol.Left := EdLeft;
  if Parent <> nil then
     selfcontrol.Parent := Parent;
  else
     selfcontrol.Parent := self;
  selfcontrol.Show;
end;
请问该怎样修改才能达到我的要求

解决方案 »

  1.   

    TWinControl:EdLeft之间的冒号改成分号
      

  2.   

    你的函数定义我就没看明白.
    procedure CreateControl(Tselfcontrol:TWinControl://TSelfControl???????
    EdLeft,EdTop:Integer;Parent:TWinControl);
      

  3.   

    Tselfcontrol:TWinControl//传入的控件类,如TEdit,TLabel等等
    EdLeft,EdTop:Integer//控件的位置参数
    Parent:TWinControl//控件的Parent
    谢谢了
      

  4.   

    type
            TSelfcontrol=TWincontrol;//////////////////////////
    //...
    procedure TForm1.CreateControl(selfcontrol:TSelfcontrol;EdLeft,EdTop:Integer;Parent:TWinControl);
    //var selfcontrol: Tmyselfcontrol;//系统提示:Constant or type identifier expected
    begin
      selfcontrol := Tselfcontrol.Create(self);
      selfcontrol.Top := EdTop;
      selfcontrol.Left := EdLeft;
      if Parent <> nil then
         selfcontrol.Parent := Parent
      else
         selfcontrol.Parent := self;
      selfcontrol.Show;
    end;
      

  5.   

    看看Application.CreateForm()的源代码吧,我想能很好解决你的问题