📄 informationform.pas
字号:
unit InformationForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls, DBTables, Db, Common, ImgList;
type
TfrmInformation = class(TForm)
ImageList: TImageList;
Image: TImage;
lbInformation: TLabel;
btnOK: TBitBtn;
btnCancel: TBitBtn;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
ActiveButton :TActiveButton;
procedure ShowError(Str:String);
procedure ShowHint(Str:String);
function ShowQuestion(Str:String):TModalResult;
// function ShowQuestionOK(Str:string):TModalResult;
procedure ShowWarning(Str:String);
end;
var
frmInformation: TfrmInformation;
implementation
{$R *.DFM}
{ TfrmInformation }
{ TfrmInformation }
procedure TfrmInformation.ShowError(Str: String);
begin
Image.Picture := nil;
ImageList.GetBitmap(3,Image.Picture.Bitmap);
lbInformation.Caption := Str;
btnCancel.Visible := False;
btnOK.Left := 133;
ActiveButton := abOK;
showModal;
end;
procedure TfrmInformation.ShowHint(Str: String);
begin
Image.Picture := nil;
ImageList.GetBitmap(0,Image.Picture.Bitmap);
lbInformation.Caption := Str;
btnOK.Left := 133;
btnCancel.Visible := False;
ActiveButton := abOK;
showModal;
end;
function TfrmInformation.ShowQuestion(Str: String): TModalResult;
begin
Image.Picture := nil;
ImageList.GetBitmap(1,Image.Picture.Bitmap);
lbInformation.Caption := Str;
btnCancel.Visible := True;
btnOK.Left := 91;
btnCancel.Left := 192;
btnOK.Caption := '是';
btnCancel.Caption := '否';
result := showModal;
btnOK.Caption := '确认';
btnCancel.Caption := '取消';
end;
procedure TfrmInformation.ShowWarning(Str: String);
begin
Image.Picture := nil;
ImageList.GetBitmap(2,Image.Picture.Bitmap);
lbInformation.Caption := Str;
btnCancel.Visible := False;
btnOK.Left := 133;
ActiveButton := abOK;
showModal;
end;
procedure TfrmInformation.FormActivate(Sender: TObject);
begin
if ActiveButton = abOK then
btnOK.SetFocus
else
btnCancel.SetFocus;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -