📄 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, HexChFrm;
procedure ShowWinMgrForm;
var
Frm: TWinMgrForm;
begin
Frm := TWinMgrForm.Create(Application);
Frm.ShowModal;
Frm.Free;
end;
procedure TWinMgrForm.FillListView;
var
HexFrm: THexChForm;
ListItem: TListItem;
i: Integer;
begin
WinListView.Items.BeginUpdate;
WinListView.Items.Clear;
for i := 0 to MHMainForm.MDIChildCount - 1 do
begin
if MHMainForm.MDIChildren[i] is THexChForm then
begin
HexFrm := (MHMainForm.MDIChildren[i] as THexChForm);
ListItem := WinListView.Items.Add;
ListItem.Caption := HexFrm.FileName;
ListItem.SubItems.Add(IntToStr(HexFrm.BufSize));
ListItem.SubItems.Add(IntToStr(HexFrm.Offset));
if HexFrm.Modified then
ListItem.SubItems.Add('已修改')
else
ListItem.SubItems.Add('未修改');
ListItem.Data := HexFrm;
if MHMainForm.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;
(MHMainForm.MDIChildren[Idx] as THexChForm).BringToFront;
Close;
end;
procedure TWinMgrForm.CloseWinButtonClick(Sender: TObject);
var
Idx: Integer;
begin
if WinListView.Selected = nil then Exit;
Idx := WinListView.Selected.Index;
(MHMainForm.MDIChildren[Idx] as THexChForm).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 + -