RefForm.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:5k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit RefForm;
- interface
- uses
- SysUtils, Qt, Classes, QGraphics, QControls, QForms, QDialogs,
- QComCtrls, QMenus, QImgList, QTypes;
- type
- TForm1 = class(TForm)
- ListView1: TListView;
- MainMenu1: TMainMenu;
- File1: TMenuItem;
- Exit1: TMenuItem;
- View1: TMenuItem;
- List1: TMenuItem;
- Details1: TMenuItem;
- Help1: TMenuItem;
- About1: TMenuItem;
- N1: TMenuItem;
- CheckBoxes1: TMenuItem;
- ImagesLarge: TImageList;
- ImagesSmall: TImageList;
- AddItem1: TMenuItem;
- N2: TMenuItem;
- procedure FormCreate(Sender: TObject);
- procedure List1Click(Sender: TObject);
- procedure Details1Click(Sender: TObject);
- procedure Exit1Click(Sender: TObject);
- procedure About1Click(Sender: TObject);
- procedure CheckBoxes1Click(Sender: TObject);
- procedure ListView1ColumnClick(Sender: TObject; Column: TListColumn);
- procedure ListView1Compare(Sender: TObject; Item1, Item2: TListItem;
- Data: Integer; var Compare: Integer);
- procedure FormDestroy(Sender: TObject);
- procedure AddItem1Click(Sender: TObject);
- procedure ListView1ItemDoubleClick(Sender: TObject; Item: TListItem);
- public
- { Public declarations }
- private
- nSortCol: Integer;
- end;
- var
- Form1: TForm1;
- implementation
- uses NewDial;
- {$R *.xfm}
- procedure TForm1.FormCreate(Sender: TObject);
- var
- List: TStringList;
- NewItem: TListItem;
- I: Integer;
- begin
- // stops warning message
- NewItem := nil;
- // load the items
- ListView1.Items.Clear;
- List := TStringList.Create;
- try
- List.LoadFromFile (
- ExtractFilePath (Application.ExeName) + 'Items.txt');
- for I := 0 to List.Count - 1 do
- if List [I][1] = #9 then
- NewItem.SubItems.Add (Trim (List [I]))
- else if List [I][1] = '@' then
- NewItem.ImageIndex := StrToIntDef (List [I][2], 0)
- else
- begin
- // a new item
- NewItem := ListView1.Items.Add;
- NewItem.Caption := List [I];
- end;
- finally
- List.Free;
- end;
- end;
- procedure TForm1.List1Click(Sender: TObject);
- begin
- ListView1.ViewStyle := vsList;
- List1.Checked := True;
- end;
- procedure TForm1.Details1Click(Sender: TObject);
- begin
- ListView1.ViewStyle := vsReport;
- Details1.Checked := True;
- end;
- procedure TForm1.Exit1Click(Sender: TObject);
- begin
- Close;
- end;
- procedure TForm1.About1Click(Sender: TObject);
- begin
- MessageDlg ('Reference List (ListView example)' +
- #13'from "Mastering Delphi"'#13'author: Marco Cant