📄 userinfofrm.pas
字号:
unit UserInfoFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, NhGlobalST;
type
TUserInfoForm = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
UserNameText: TStaticText;
Label2: TLabel;
UserLevelText: TStaticText;
Label3: TLabel;
UserOnlineText: TStaticText;
Label4: TLabel;
UserVipText: TStaticText;
Panel1: TPanel;
TimerClose: TTimer;
procedure TimerCloseTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function ShowUserInfoForm(VPoint: TPoint; const UserInfo: TBaseUserInfo): TUserInfoForm;
procedure HideUserInfoForm;
var
UserInfoForm: TUserInfoForm = nil;
implementation
uses ProjectUtils;
{$R *.dfm}
function ShowUserInfoForm(VPoint: TPoint; const UserInfo: TBaseUserInfo): TUserInfoForm;
begin
if UserInfoForm = nil then
begin
UserInfoForm := TUserInfoForm.Create(Application);
end;
UserInfoForm.UserNameText.Caption := ' ' + UserInfo.UserName;
UserInfoForm.UserLevelText.Caption := ' ' + Format('%s(等级%d)', [UserInfo.LevelName, UserInfo.Level]);
UserInfoForm.UserOnlineText.Caption := ' ' + GetTimeDisplay(UserInfo.OnlineTime);
UserInfoForm.UserVipText.Caption := ' ' + UserInfo.VirtualIP;
UserInfoForm.Left := VPoint.X - UserInfoForm.Width;
UserInfoForm.Top := VPoint.Y;
UserInfoForm.Show;
SetForegroundWindow(UserInfoForm.Handle);
SetCapture(UserInfoForm.Handle);
Result := UserInfoForm;
end;
procedure HideUserInfoForm;
begin
if UserInfoForm <> nil then
begin
UserInfoForm.Hide;
FreeAndNil(UserInfoForm);
end;
end;
procedure TUserInfoForm.TimerCloseTimer(Sender: TObject);
begin
HideUserInfoForm;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -