📄 umyapp.pas
字号:
unit uMyApp;
interface
uses
SysUtils, ExtCtrls, Forms;
Type
TMyApp = class
private
FUserId: string;
FUserPwd: string;
FAdmin: Boolean;
FTopic: string;
FPath: string;
FImage: TImage;
FImgStr: string;
FStaBirth: Boolean;
procedure SetTopic(const Value: string);
procedure SetImgStr(const Value: string);
public
constructor Create;
property UserID: string read FUserId write FUserId;
property UserPwd: string read FUserPwd write FUserPwd;
property Admin: Boolean read FAdmin write FAdmin;
property Topic: string read FTopic write SetTopic;
property Path: string read FPath;
property Image: TImage read FImage write FImage;
property ImgStr: string read FImgStr write SetImgStr;
property StaBirth: Boolean read FStaBirth write FStaBirth;
end;
implementation
{ TApp }
constructor TMyApp.Create;
begin
FPath := ExtractFilePath(Application.ExeName);
end;
procedure TMyApp.SetImgStr(const Value: string);
begin
if FImgStr <> Value then
begin
FImgStr := Value;
if not Assigned(FImage) then Exit;
if Value = 'main.jpg' then
FImage.Picture.LoadFromFile(FPath + Value)
else if FileExists(Value) then
FImage.Picture.LoadFromFile(Value);
end;
end;
procedure TMyApp.SetTopic(const Value: string);
begin
if FTopic <> Value then
begin
FTopic := Value;
if Assigned(Application.MainForm) then
begin
Application.MainForm.Caption := Value;
if FUserID <> '' then
begin
Application.MainForm.Caption := Application.MainForm.Caption + ' 管理员:' + FUserID;
Application.MainForm.Caption := Application.MainForm.Caption + ' --系统管理员';
end;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -