zoukankan      html  css  js  c++  java
  • delphi Tlist 不太懂

     1 type
     2   TForm1 = class(TForm)
     3     Button1: TButton;
     4     Label1: TLabel;
     5     Button2: TButton;
     6     procedure Button1Click(Sender: TObject);
     7     procedure Button2Click(Sender: TObject);
     8   private
     9     { Private declarations }
    10   public
    11     { Public declarations }
    12   end;
    13 
    14   WList = record
    15     Cone   :String;
    16     Ctwo   :String;
    17     end;
    18   wMyList = ^WList;
    19 
    20 var
    21   Form1: TForm1;
    22 
    23   MyList  : TList;
    24 
    25 implementation
    26 
    27 {$R *.dfm}
    28 
    29 procedure TForm1.Button1Click(Sender: TObject);
    30 var
    31    Rows :wMyList;
    32 
    33 begin
    34    MyList := TList.Create;
    35    new(Rows);
    36    Rows.Cone   := '神奇';
    37    Rows.Ctwo := '魔力';
    38    MyList.Add(Pointer(Rows));
    39 end;
    40 
    41 procedure TForm1.Button2Click(Sender: TObject);
    42 var
    43    Rows :wMyList;
    44 begin
    45    if MyList = nil then
    46    begin
    47      exit;
    48    end
    49    else
    50    begin
    51      Rows:= wMyList(MyList.Items[0]);
    52      Label1.Caption := Rows.Cone + Rows.Ctwo;
    53    end;
    54 end;

    delphi 用起来有点麻烦啊。。 

  • 相关阅读:
    实验五
    实验一
    实验四
    实验三
    实验8 SQLite数据库操作
    实验7 BindService模拟通信
    实验6 在应用程序中播放音频和视频
    实验5 数独游戏界面设计
    实验4 颜色、字符串资源的使用
    实验五 存储管理实验
  • 原文地址:https://www.cnblogs.com/ccqin/p/2589707.html
Copyright © 2011-2022 走看看