📄 winmgrfrm.pas
字号:
unit WinMgrFrm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ImgList;
type
TWinMgrForm = class(TForm)
WinListView: TListView;
ShowWinButton: TButton;
CloseWinButton: TButton;
CancelButton: TButton;
ImageList: TImageList;
procedure ShowWinButtonClick(Sender: TObject);
procedure CloseWinButtonClick(Sender: TObject);
procedure CancelButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure WinListViewDblClick(Sender: TObject);
private
{ Private declarations }
procedure FillListView;
public
{ Public declarations }
end;
var
WinMgrForm: TWinMgrForm;
procedure ShowWinMgrForm;
implementation
{$R *.DFM}
uses MainFrm, ChildFrm;
procedure ShowWinMgrForm;
var
Frm: TWinMgrForm;
begin
Frm := TWinMgrForm.Create(Application);
Frm.ShowModal;
Frm.Free;
end;
procedure TWinMgrForm.FillListView;
var
HexFrm: TChildForm;
ListItem: TListItem;
I: Integer;
begin
WinListView.Items.BeginUpdate;
WinListView.Items.Clear;
for I := 0 to MainForm.MDIChildCount - 1 do
begin
if MainForm.MDIChildren[I] is TChildForm then
begin
HexFrm := (MainForm.MDIChildren[I] as TChildForm);
ListItem := WinListView.Items.Add;
ListItem.Caption := HexFrm.FileName;
ListItem.SubItems.Add(IntToStr(HexFrm.HexEdit.DataSize));
ListItem.SubItems.Add(IntToStr(HexFrm.HexEdit.Offset));
if HexFrm.HexEdit.Modified then
ListItem.SubItems.Add('已修改')
else
ListItem.SubItems.Add('未修改');
ListItem.Data := HexFrm;
if MainForm.ActiveMDIChild = HexFrm then
WinListView.Selected := ListItem;
end;
end;
WinListView.Items.EndUpdate;
end;
procedure TWinMgrForm.FormCreate(Sender: TObject);
begin
FillListView;
end;
procedure TWinMgrForm.ShowWinButtonClick(Sender: TObject);
var
Idx: Integer;
begin
if WinListView.Selected = nil then Exit;
Idx := WinListView.Selected.Index;
(MainForm.MDIChildren[Idx] as TChildForm).BringToFront;
Close;
end;
procedure TWinMgrForm.CloseWinButtonClick(Sender: TObject);
var
Idx: Integer;
begin
if WinListView.Selected = nil then Exit;
Idx := WinListView.Selected.Index;
(MainForm.MDIChildren[Idx] as TChildForm).Close;
Application.ProcessMessages;
FillListView;
WinListView.SetFocus;
end;
procedure TWinMgrForm.CancelButtonClick(Sender: TObject);
begin
Close;
end;
procedure TWinMgrForm.WinListViewDblClick(Sender: TObject);
begin
ShowWinButtonClick(nil);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -