⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 movememoryu.pas

📁 DelphiWin32核心API参考光盘内容.是学习书籍中的源码,便于学习.
💻 PAS
字号:
unit MoveMemoryu;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids;

type
  TForm1 = class(TForm)
    Button1: TButton;
    StringGrid1: TStringGrid;
    StringGrid2: TStringGrid;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Array1,Array2: array[0..400] of Integer;  // holds the information to be moved

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  iLoop: Integer;   // general loop counter
begin
  {move the information from one array to the other}
  MoveMemory(@Array2,@Array1,SizeOf(Array1));

  {display the information}
  for iLoop := 0 to 400 do
  begin
    StringGrid1.Cells[iLoop,0] := IntToStr(Array1[iLoop]);
    StringGrid2.Cells[iLoop,0] := IntToStr(Array2[iLoop]);
  end;

end;

procedure TForm1.FormCreate(Sender: TObject);
var
  iLoop: Integer;    // general loop counter
begin
  {initialize the arrays}
  for iLoop := 0 to 400 do
  begin
    {set the values in this array to equal the loop counter}
    Array1[iLoop] := iLoop;
    StringGrid1.Cells[iLoop,0] := IntToStr(Array1[iLoop]);

    {set all values in this array to zero}
    Array2[iLoop] := 0;
    StringGrid2.Cells[iLoop,0] := IntToStr(Array2[iLoop]);
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -