在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
使用Delphi几年后,居然不知道还可以这么用,惭愧呀
type
PMyRec = ^TMyRec; TMyRec = record FName: string; LName: string; end; procedure TForm1.Button1Click(Sender: TObject); var MyRecPtr: PMyRec; TreeViewIndex: LongInt; begin New(MyRecPtr); MyRecPtr^.FName := Edit1.Text; MyRecPtr^.LName := Edit2.Text; TreeViewIndex := StrToInt(Edit3.Text); with TreeView1 do begin if Items.Count = 0 then Items.AddObject(nil, 'Item' + IntToStr(TreeViewIndex), MyRecPtr) else if (TreeViewIndex < Items.Count) and (TreeViewIndex >= 0) then Items.AddObject(Items[TreeViewIndex], 'Item' + IntToStr(TreeViewIndex), MyRecPtr); end; end; procedure TForm1.Button2Click(Sender: TObject); begin Label1.Caption := PMyRec(TreeView1.Selected.Data)^.FName + ' ' + PMyRec(TreeView1.Selected.Data)^.LName; end; |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论