📄 selectform.pas
字号:
unit SelectForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TShowType = (stSelection, stStat);
TSelectFrm = class(TForm)
Panel1: TPanel;
GroupBox1: TGroupBox;
ListBox1: TListBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
Handle: THandle;
ShowType: TShowType;
public
{ Public declarations }
Procedure SetContext(aHandle: Thandle; aItem: string; aShowType: TShowType);
end;
implementation
uses uMsgConst;
{$R *.dfm}
procedure TSelectFrm.BitBtn1Click(Sender: TObject);
var
AMessage: TMessage;
begin
if ListBox1.ItemIndex <> -1 then
begin
if ShowType = stSelection then
AMessage.Msg:= SELECTION_DETAIL_MSG // 信息齐全了
else if ShowType = stStat then
AMessage.Msg:= STAT_DETAIL_MSG; // 信息齐全了
SendMessage(Handle,AMessage.Msg,0,0);
if ListBox1.Items.Count = 1 then
Close;
end
else
Application.MessageBox('请选择一条记录!','提示信息!',mb_ok);
end;
procedure TSelectFrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:= cahide;
end;
procedure TSelectFrm.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TSelectFrm.SetContext(aHandle: Thandle; aItem: string; aShowType: TShowType);
begin
if Handle <> aHandle then
Handle:= aHandle;
if ShowType <> aShowType then
ShowType:= aShowType;
ListBox1.Items.add(aItem);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -