📄 informationf.pas
字号:
{ *********************************************************************** }
{ Unit Name: InformationF
{ Purpose: System Show Information Form
{ Author: Cyclone
{ History:
{ 2005-3-20 10:54:57 Create the function
{ *********************************************************************** }
unit InformationF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BaseF, StdCtrls, CycLabel, Buttons, CycSpeedButton, CycPanel,
ExtCtrls, PubFuns, ImgList;
type
TfmInformation = class(TfmBase)
imgIcon: TImage;
pnlFooter: TPanel;
pnlFooterLine: TCycPanel;
btnOK: TCycSpeedButton;
btnNo: TCycSpeedButton;
btnYes: TCycSpeedButton;
lblInformation: TCycLabel;
imgIcons: TImageList;
procedure btnYesClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure btnNoClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
class function ShowInformation(const InformationType: TInformationType; const Information: String): Integer;
end;
var
fmInformation: TfmInformation;
implementation
{$R *.dfm}
{ TfmInformation }
{-----------------------------------------------------------------------------
Procedure: TfmInformation.ShowInformation
Purpose: Show Information
Arguments: const InformationType: TInformationType; const Information: String
Result: Integer
Author: Cyclone
Date: 2005-3-20 10:55:26
-----------------------------------------------------------------------------}
class function TfmInformation.ShowInformation(
const InformationType: TInformationType; const Information: String): Integer;
begin
fmInformation := TfmInformation.Create(Application);
try
with fmInformation do
begin
btnOK.Visible := False;
btnYes.Visible := False;
btnNo.Visible := False;
case InformationType of
intInformation: begin
Caption := 'Information';
imgIcons.Draw(imgIcon.Canvas, 0, 0, 0);
btnOK.Visible := True;
end;
intWarning: begin
Caption := 'Warning';
imgIcons.Draw(imgIcon.Canvas, 0, 0, 1);
btnOK.Visible := True;
end;
intError: begin
Caption := 'Error';
imgIcons.Draw(imgIcon.Canvas, 0, 0, 2);
btnOK.Visible := True;
end;
intQuestion: begin
Caption := 'Question';
imgIcons.Draw(imgIcon.Canvas, 0, 0, 3);
btnYes.Visible := True;
btnNo.Visible := True;
end;
end;
lblInformation.Caption := Information;
Result := ShowModal;
end;
finally
FreeAndNil(fmInformation);
end;
end;
procedure TfmInformation.btnYesClick(Sender: TObject);
begin
ModalResult := mrYes;
end;
procedure TfmInformation.btnOKClick(Sender: TObject);
begin
ModalResult := mrOK;
end;
procedure TfmInformation.btnNoClick(Sender: TObject);
begin
ModalResult := mrNo;
end;
procedure TfmInformation.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
if btnYes.Visible then
btnYes.Click
else
btnOK.Click;
end
else
inherited;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -