[Error] Unit1.pas(16): Undeclared identifier: 'PaintBox1Paint'
[Error] Unit1.pas(16): ';' expected but '(' found
[Error] Unit1.pas(23): Statements not allowed in interface part
[Error] Unit1.pas(24): Undeclared identifier: 'PaintBox1'
[Error] Unit1.pas(26): Undeclared identifier: 'Handle'
[Error] Unit1.pas(27): Undeclared identifier: 'Height'
[Error] Unit1.pas(28): Undeclared identifier: 'Width'
[Error] Unit1.pas(32): Undeclared identifier: 'Canvas'
[Error] Unit1.pas(32): 'END' expected but ',' found
[Error] Unit1.pas(40): Missing operator or semicolon
[Error] Unit1.pas(43): Missing operator or semicolon
。。
。。太多错了。思维很乱!!!!!!!!!

解决方案 »

  1.   

    [Error] Unit1.pas(16): Undeclared identifier: 'PaintBox1Paint'
    [Error] Unit1.pas(16): ';' expected but '(' found
    [Error] Unit1.pas(23): Statements not allowed in interface part
    [Error] Unit1.pas(24): Undeclared identifier: 'PaintBox1'
    [Error] Unit1.pas(26): Undeclared identifier: 'Handle'
    [Error] Unit1.pas(27): Undeclared identifier: 'Height'
    [Error] Unit1.pas(28): Undeclared identifier: 'Width'
    [Error] Unit1.pas(32): Undeclared identifier: 'Canvas'
    [Error] Unit1.pas(32): 'END' expected but ',' found
    [Error] Unit1.pas(40): Missing operator or semicolon
    [Error] Unit1.pas(43): Missing operator or semicolon
    。。
    。。太多错了。思维很乱!!!!!!!!!
      

  2.   

    procedure TForm1.PaintBox1Paint(Sender: TObject);
    const
      GridSpace = 16;
    var
      iRowCount, iColCount: Integer; //行数和列数
      i: Integer; //循环计数
      p: TPoint; //存放物理坐标
    begin
      with TPaintBox(Sender) do
      begin
        SetMapMode(Handle, MM_HIMETRIC);
        iRowCount := Height div GridSpace;
        iColCount := Width div GridSpace;    { 绘制黑色边框 }
        p := Point(Width, Height); //控件右下角的物理坐标
        p.X := p.X + Left; //
        p.Y := p.Y + Top; //
        DPToLP(Canvas.Handle, p, 1); //将物理坐标转为逻辑坐标
        Canvas.Pen.Color := clBlack;
        Canvas.Pen.Style := psSolid;
        Canvas.Brush.Color := clWhite;
        Canvas.Rectangle(0, 0, p.X, p.Y);    Canvas.Pen.Color := clBtnface;
        { 绘制水平网格线 }
        for i := 1 to iRowCount - 1 do
        begin
          if odd(i) then
            Canvas.Pen.Style := psSolid
          else
            Canvas.Pen.Style := psDot;
          p := Point(1, i * GridSpace);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.MoveTo(p.X, p.Y);
          p := Point(Width - 1, i * GridSpace);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.LineTo(p.X, p.Y);
        end;    { 绘制垂直网格线 }
        for i := 1 to iColCount - 1 do
        begin
          if odd(i) then
            Canvas.Pen.Style := psSolid
          else
            Canvas.Pen.Style := psDot;
          p := Point(i * GridSpace, 1);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.MoveTo(p.X, p.Y);
          p := Point(i * GridSpace, Height - 1);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.LineTo(p.X, p.Y);
        end;
      end;
    end;
      

  3.   

    procedure TForm1.PaintBox1Paint(Sender: TObject);
    const
      GridSpace = 16;
    var
      iRowCount, iColCount: Integer; //行数和列数
      i: Integer; //循环计数
      p: TPoint; //存放物理坐标
    begin
      with TPaintBox(Sender) do
      begin
        SetMapMode(Handle, MM_HIMETRIC);
        iRowCount := Height div GridSpace;
        iColCount := Width div GridSpace;    { 绘制黑色边框 }
        p := Point(Width, Height); //控件右下角的物理坐标
        p.X := p.X + Left; //
        p.Y := p.Y + Top; //
        DPToLP(Canvas.Handle, p, 1); //将物理坐标转为逻辑坐标
        Canvas.Pen.Color := clBlack;
        Canvas.Pen.Style := psSolid;
        Canvas.Brush.Color := clWhite;
        Canvas.Rectangle(0, 0, p.X, p.Y);    Canvas.Pen.Color := clBtnface;
        { 绘制水平网格线 }
        for i := 1 to iRowCount - 1 do
        begin
          if odd(i) then
            Canvas.Pen.Style := psSolid
          else
            Canvas.Pen.Style := psDot;
          p := Point(1, i * GridSpace);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.MoveTo(p.X, p.Y);
          p := Point(Width - 1, i * GridSpace);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.LineTo(p.X, p.Y);
        end;    { 绘制垂直网格线 }
        for i := 1 to iColCount - 1 do
        begin
          if odd(i) then
            Canvas.Pen.Style := psSolid
          else
            Canvas.Pen.Style := psDot;
          p := Point(i * GridSpace, 1);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.MoveTo(p.X, p.Y);
          p := Point(i * GridSpace, Height - 1);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.LineTo(p.X, p.Y);
        end;
      end;
    end;
      

  4.   

    Delphi5 调试通过,如果真的不行,请把单元文件发给我
      

  5.   

    谁能够调试,给我说过公道话吧unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ExtCtrls;type
      TForm1 = class(TForm)
        PaintBox1: TPaintBox;
        PaintBox2: TPaintBox;
        procedure PaintBox1Paint(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}//在窗体上放一个PaintBox,其Left和Top属性不设为0,然后在其OnPaint事件中输入如下代码,为什么网络会画不全,但如果Left和Top属性设为0,则能够画出来。
    //请帮忙调试一下。
    procedure TForm1.PaintBox1Paint(Sender: TObject);
    const
      GridSpace = 16;
    var
      iRowCount, iColCount: Integer; //行数和列数
      i: Integer; //循环计数
      p: TPoint; //存放物理坐标
    begin
      with TPaintBox(Sender) do
      begin
        SetMapMode(Handle, MM_HIMETRIC);
        iRowCount := Height div GridSpace;
        iColCount := Width div GridSpace;    { 绘制黑色边框 }
        p := Point(Width, Height); //控件右下角的物理坐标
        p.X := p.X + Left; //
        p.Y := p.Y + Top; //
        DPToLP(Canvas.Handle, p, 1); //将物理坐标转为逻辑坐标
        Canvas.Pen.Color := clBlack;
        Canvas.Pen.Style := psSolid;
        Canvas.Brush.Color := clWhite;
        Canvas.Rectangle(0, 0, p.X, p.Y);    Canvas.Pen.Color := clBtnface;
        { 绘制水平网格线 }
        for i := 1 to iRowCount - 1 do
        begin
          if odd(i) then
            Canvas.Pen.Style := psSolid
          else
            Canvas.Pen.Style := psDot;
          p := Point(1, i * GridSpace);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.MoveTo(p.X, p.Y);
          p := Point(Width - 1, i * GridSpace);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.LineTo(p.X, p.Y);
        end;    { 绘制垂直网格线 }
        for i := 1 to iColCount - 1 do
        begin
          if odd(i) then
            Canvas.Pen.Style := psSolid
          else
            Canvas.Pen.Style := psDot;
          p := Point(i * GridSpace, 1);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.MoveTo(p.X, p.Y);
          p := Point(i * GridSpace, Height - 1);
          p.X := p.X + Left; //
          p.Y := p.Y + Top; //
          DPToLP(Canvas.Handle, p, 1);
          Canvas.LineTo(p.X, p.Y);
        end;
      end;
    end;end.
      

  6.   

    object Form1: TForm1
      Left = 192
      Top = 107
      Width = 544
      Height = 375
      Caption = 'Form1'
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object PaintBox1: TPaintBox
        Left = 264
        Top = 112
        Width = 233
        Height = 145
        OnPaint = PaintBox1Paint
      end
      object PaintBox2: TPaintBox
        Left = 8
        Top = 24
        Width = 297
        Height = 297
        OnPaint = PaintBox1Paint
      end
    end