小弟是初学,遇到困难了。。
代码如下:(Unit1.pas)
1 unit Unit1;

3 interface

5 uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, ExtCtrls, StdCtrls;

9 type
10 TForm1 = class(TForm)
11 Button1: TButton;12 procedure TForm1.FormMouseDown (Sender: TObject; Button: TMouseButton;
13 Shift: TShiftState; X, Y: Integer);
14 var
15 btn: TButton;
16 begin
17 btn:=TButton.Create (Self);
18 btn.Parent:=Self;
19 btn.Left:=X;
20 btn.Top:=Y
21 btn.Width:=btn.Width+50;
22 btn.Caption:=Format('Button at %d,%d',[X,Y]);
23 
24 end;25 end.在RUN时发生错误,出现 error 窗口,说“Expected '='but '(' found.
光标指在第12行,请问这是何原因? [谢谢]

解决方案 »

  1.   

    改为1 unit Unit1;

    3 interface

    5 uses
    6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    7 Dialogs, ExtCtrls, StdCtrls;

    9 type
    10 TForm1 = class(TForm)
    11 Button1: TButton;
      procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
      procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}
    12 procedure TForm1.FormMouseDown (Sender: TObject; Button: TMouseButton;
    13 Shift: TShiftState; X, Y: Integer);
    14 var
    15 btn: TButton;
    16 begin
    17 btn:=TButton.Create (Self);
    18 btn.Parent:=Self;
    19 btn.Left:=X;
    20 btn.Top:=Y
    21 btn.Width:=btn.Width+50;
    22 btn.Caption:=Format('Button at %d,%d',[X,Y]);
    23 
    24 end;25 end.你误把这些行删除了