先在use语句中加入stdctrls
procedure tform1.formmousedown(sender:tobject;;button:tmousebutton;
          shift:tshiftstate;x,y:integer;);
var
   btn:tbutton;
begin
    btn:=tbutton.create(self);
btn.parent:self;
btn.left:=x;
btn.top:=y;
btn.width:btn.width+30;
btn.caption:=format('button at %d,%d',[x,y]);
end;
我试过了。