📄 anmsninfo.pas
字号:
unit AnMsnInfo;
interface
uses
AnMsgFrm,SysUtils, Classes,typinfo;
type
TMsgKind = (mkError, mkInfo, mkWarning);
TShowPos = (spLeft, spRight, spRightTop, spRightBottom);
TAnMsnInfo = class(TComponent)
private
AnMsgType :TMsgKind;
AnShowPos : TShowPos ;
AnShowDelay : Integer;
AnVerSion : String;
procedure SetShowDelay(Value: Integer);
procedure SetMessageInfo(Value:String);
function GetMessageInfo:String;
{ Private declarations }
protected
{ Protected declarations }
public
procedure Execute;//发送信息
{ Public declarations }
published
{ Published declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy; override;
property Version :String read AnVerSion write AnVerSion ;//版本
property MsgType : TMsgKind read AnMsgType write AnMsgType
default mkInfo ;//提示类型
property ShowType : TShowPos read AnShowPos write AnShowPos
default spRightBottom;//显示位置
property ShowDelays : Integer read AnShowDelay write SetShowDelay
default 5 ;//设置延时
property MessgeInfo : String read GetMessageInfo write SetMessageInfo;
//显示的信息
end;
procedure Register;
implementation
uses Dialogs;
procedure Register;
begin
RegisterComponents('AnComponent', [TAnMsnInfo]);
end;
{★★★★★★★★★★★★★★★★★★★★★★★★★★★}
constructor TAnMsnInfo.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
Version :='AnMsgInfo V2.0 Copy Right By ANTAN';
ShowType := spRightBottom ;
ShowDelay := 5;
MsgType := mkInfo;
MessgeInfo :='Hello,Thanks for used AnMsgInfo Component!';
end;
destructor TAnMsnInfo.Destroy;
begin
inherited Destroy;
end;
{★★★★★★★★★★★★★★★★★★★★★★★★★★★}
procedure TAnMsnInfo.Execute;
begin
if MessgeInfo <> EmptyStr then
begin
ShowDelay :=ShowDelays;//延时
case Ord(MsgType) of // 提示窗口类型
0: ShowError(MessgeInfo);
1: ShowInfo(MessgeInfo);
2: ShowWarning(MessgeInfo);
end;
end
else MessageDlg('信息内容不能为空!', mtError, [mbOK], 0)
end;
function TAnMsnInfo.GetMessageInfo: String;
begin
result := 'Hello,Thanks for used AnMsgInfo Component!';
end;
procedure TAnMsnInfo.SetMessageInfo(Value: String);
begin
if Value <> EmptyStr then
if MessgeInfo <> Value then MessgeInfo := Value ;
end;
procedure TAnMsnInfo.SetShowDelay(Value:Integer);//设置延时
begin
if AnShowDelay <> Value then
if Value > 5 then AnShowDelay := Value
else AnShowDelay := 5;//默认是5
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -