unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    procedure formshow(sender:tobject);
    procedure formresize(sender:tobject);
    procedure formcreate(sender:tobject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure showsize;
    procedure restrictsize(var msg:tmessage);
    message wm_getminmaxinfo;
  end;var
  Form1: TForm1;implementation{$R *.dfm}
procedure tform1.showsize;
begin
label4.Caption:=inttostr(width);
label5.Caption:=inttostr(height);
end;end.
想用label4,5显示窗体的宽度和高度嘛
以上代码按书的的抄的
为什么还出错还有,小弟经常都是遇到这样的问题
书上原原本本的代码经常出错
说什么没定义什么什么的各位能传受一点看书的技巧吗
就是按书的的例子实践哪

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        Label4: TLabel;
        Label5: TLabel;
        //procedure formshow(sender:tobject);
        //procedure formresize(sender:tobject);
        //procedure formcreate(sender:tobject);
      private
        { Private declarations }
      public
        { Public declarations }
        procedure showsize;
        //procedure restrictsize(var msg:tmessage);
        //message wm_getminmaxinfo;
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure tform1.showsize;
    begin
    label4.Caption:=inttostr(width);
    label5.Caption:=inttostr(height);
    end;end.
    //有些函数你定义了,但是在代码中没有就会出错的,试试上面的代码应该没有问题了