📄 forms.pas
字号:
property AutoSize;
property BiDiMode;
property BorderIcons;
property BorderStyle;
property BorderWidth;
property Caption;
property ClientHeight;
property ClientWidth;
property Color;
property TransparentColor default False;
property TransparentColorValue default 0;
property Constraints;
property Ctl3D;
property UseDockManager;
property DefaultMonitor;
property DockSite;
property DragKind;
property DragMode;
property Enabled;
property ParentFont default False;
property Font;
property FormStyle;
property Height;
property HelpFile;
property HorzScrollBar;
property Icon;
property KeyPreview;
property Menu;
property OldCreateOrder;
property ObjectMenuItem;
property ParentBiDiMode;
property PixelsPerInch;
property PopupMenu;
property Position;
property PrintScale;
property Scaled;
property ScreenSnap default False;
property ShowHint;
property SnapBuffer default 10;
property VertScrollBar;
property Visible;
property Width;
property WindowState;
property WindowMenu;
property OnActivate;
property OnCanResize;
property OnClick;
property OnClose;
property OnCloseQuery;
property OnConstrainedResize;
property OnContextPopup;
property OnCreate;
property OnDblClick;
property OnDestroy;
property OnDeactivate;
property OnDockDrop;
property OnDockOver;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnGetSiteInfo;
property OnHide;
property OnHelp;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnPaint;
property OnResize;
property OnShortCut;
property OnShow;
property OnStartDock;
property OnUnDock;
end;
TFormClass = class of TForm;
{ TCustomDockForm }
TCustomDockForm = class(TCustomForm)
private
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTESt;
procedure WMNCLButtonDown(var Message: TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
procedure CMControlListChange(var Message: TMessage); message CM_CONTROLLISTCHANGE;
procedure CMDockNotification(var Message: TCMDockNotification); message CM_DOCKNOTIFICATION;
procedure CMUnDockClient(var Message: TCMUnDockClient); message CM_UNDOCKCLIENT;
procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED;
protected
procedure DoAddDockClient(Client: TControl; const ARect: TRect); override;
procedure DoRemoveDockClient(Client: TControl); override;
procedure GetSiteInfo(Client: TControl; var InfluenceRect: TRect;
MousePos: TPoint; var CanDock: Boolean); override;
procedure Loaded; override;
public
constructor Create(AOwner: TComponent); override;
property AutoScroll default False;
property BorderStyle default bsSizeToolWin;
property FormStyle default fsStayOnTop;
published
property PixelsPerInch;
end;
{ TMonitor }
TMonitor = class(TObject)
private
FHandle: HMONITOR;
FMonitorNum: Integer;
function GetLeft: Integer;
function GetHeight: Integer;
function GetTop: Integer;
function GetWidth: Integer;
function GetBoundsRect: TRect;
function GetWorkareaRect: TRect;
function GetPrimary: Boolean;
public
property Handle: HMONITOR read FHandle;
property MonitorNum: Integer read FMonitorNum;
property Left: Integer read GetLeft;
property Height: Integer read GetHeight;
property Top: Integer read GetTop;
property Width: Integer read GetWidth;
property BoundsRect: TRect read GetBoundsRect;
property WorkareaRect: TRect read GetWorkareaRect;
property Primary: Boolean read GetPrimary;
end;
{ TScreen }
PCursorRec = ^TCursorRec;
TCursorRec = record
Next: PCursorRec;
Index: Integer;
Handle: HCURSOR;
end;
TMonitorDefaultTo = (mdNearest, mdNull, mdPrimary);
TScreen = class(TComponent)
private
FFonts: TStrings;
FImes: TStrings;
FDefaultIme: string;
FDefaultKbLayout: HKL;
FPixelsPerInch: Integer;
FCursor: TCursor;
FCursorCount: Integer;
FForms: TList;
FCustomForms: TList;
FDataModules: TList;
FMonitors: TList;
FCursorList: PCursorRec;
FDefaultCursor: HCURSOR;
FActiveControl: TWinControl;
FActiveCustomForm: TCustomForm;
FActiveForm: TForm;
FLastActiveControl: TWinControl;
FLastActiveCustomForm: TCustomForm;
FFocusedForm: TCustomForm;
FSaveFocusedList: TList;
FHintFont: TFont;
FIconFont: TFont;
FMenuFont: TFont;
FAlignLevel: Word;
FControlState: TControlState;
FOnActiveControlChange: TNotifyEvent;
FOnActiveFormChange: TNotifyEvent;
procedure AlignForm(AForm: TCustomForm);
procedure AlignForms(AForm: TCustomForm; var Rect: TRect);
procedure AddDataModule(DataModule: TDataModule);
procedure AddForm(AForm: TCustomForm);
procedure CreateCursors;
procedure DeleteCursor(Index: Integer);
procedure DestroyCursors;
function FindMonitor(Handle: HMONITOR): TMonitor;
procedure IconFontChanged(Sender: TObject);
function GetCustomFormCount: Integer;
function GetCustomForms(Index: Integer): TCustomForm;
function GetCursors(Index: Integer): HCURSOR;
function GetDataModule(Index: Integer): TDataModule;
function GetDataModuleCount: Integer;
function GetDefaultIME: String;
function GetDesktopTop: Integer;
function GetDesktopLeft: Integer;
function GetDesktopHeight: Integer;
function GetDesktopWidth: Integer;
function GetDesktopRect: TRect;
function GetWorkAreaRect: TRect;
function GetWorkAreaHeight: Integer;
function GetWorkAreaLeft: Integer;
function GetWorkAreaTop: Integer;
function GetWorkAreaWidth: Integer;
function GetImes: TStrings;
function GetHeight: Integer;
function GetMonitor(Index: Integer): TMonitor;
function GetMonitorCount: Integer;
function GetFonts: TStrings;
function GetForm(Index: Integer): TForm;
function GetFormCount: Integer;
procedure GetMetricSettings;
function GetWidth: Integer;
procedure InsertCursor(Index: Integer; Handle: HCURSOR);
procedure RemoveDataModule(DataModule: TDataModule);
procedure RemoveForm(AForm: TCustomForm);
procedure SetCursors(Index: Integer; Handle: HCURSOR);
procedure SetCursor(Value: TCursor);
procedure SetHintFont(Value: TFont);
procedure SetIconFont(Value: TFont);
procedure SetMenuFont(Value: TFont);
procedure UpdateLastActive;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DisableAlign;
procedure EnableAlign;
function MonitorFromPoint(const Point: TPoint;
MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor;
function MonitorFromRect(const Rect: TRect;
MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor;
function MonitorFromWindow(const Handle: THandle;
MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor;
procedure Realign;
procedure ResetFonts;
property ActiveControl: TWinControl read FActiveControl;
property ActiveCustomForm: TCustomForm read FActiveCustomForm;
property ActiveForm: TForm read FActiveForm;
property CustomFormCount: Integer read GetCustomFormCount;
property CustomForms[Index: Integer]: TCustomForm read GetCustomForms;
property Cursor: TCursor read FCursor write SetCursor;
property Cursors[Index: Integer]: HCURSOR read GetCursors write SetCursors;
property DataModules[Index: Integer]: TDataModule read GetDataModule;
property DataModuleCount: Integer read GetDataModuleCount;
property MonitorCount: Integer read GetMonitorCount;
property Monitors[Index: Integer]: TMonitor read GetMonitor;
property DesktopRect: TRect read GetDesktopRect;
property DesktopHeight: Integer read GetDesktopHeight;
property DesktopLeft: Integer read GetDesktopLeft;
property DesktopTop: Integer read GetDesktopTop;
property DesktopWidth: Integer read GetDesktopWidth;
property WorkAreaRect: TRect read GetWorkAreaRect;
property WorkAreaHeight: Integer read GetWorkAreaHeight;
property WorkAreaLeft: Integer read GetWorkAreaLeft;
property WorkAreaTop: Integer read GetWorkAreaTop;
property WorkAreaWidth: Integer read GetWorkAreaWidth;
property HintFont: TFont read FHintFont write SetHintFont;
property IconFont: TFont read FIconFont write SetIconFont;
property MenuFont: TFont read FMenuFont write SetMenuFont;
property Fonts: TStrings read GetFonts;
property FormCount: Integer read GetFormCount;
property Forms[Index: Integer]: TForm read GetForm;
property Imes: TStrings read GetImes;
property DefaultIme: string read GetDefaultIme;
property DefaultKbLayout: HKL read FDefaultKbLayout;
property Height: Integer read GetHeight;
property PixelsPerInch: Integer read FPixelsPerInch;
property Width: Integer read GetWidth;
property OnActiveControlChange: TNotifyEvent
read FOnActiveControlChange write FOnActiveControlChange;
property OnActiveFormChange: TNotifyEvent
read FOnActiveFormChange write FOnActiveFormChange;
end;
{ TApplication }
TTimerMode = (tmShow, tmHide);
PHintInfo = ^THintInfo;
THintInfo = record
HintControl: TControl;
HintWindowClass: THintWindowClass;
HintPos: TPoint;
HintMaxWidth: Integer;
HintColor: TColor;
CursorRect: TRect;
CursorPos: TPoint;
ReshowTimeout: Integer;
HideTimeout: Integer;
HintStr: string;
HintData: Pointer;
end;
TCMHintShow = record
Msg: Cardinal;
Reserved: Integer;
HintInfo: PHintInfo;
Result: Integer;
end;
TCMHintShowPause = record
Msg: Cardinal;
WasActive: Integer;
Pause: PInteger;
Result: Integer;
end;
TMessageEvent = procedure (var Msg: TMsg; var Handled: Boolean) of object;
TExceptionEvent = procedure (Sender: TObject; E: Exception) of object;
TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
TShowHintEvent = procedure (var HintStr: string; var CanShow: Boolean;
var HintInfo: THintInfo) of object;
TWindowHook = function (var Message: TMessage): Boolean of object;
TSettingChangeEvent = procedure (Sender: TObject; Flag: Integer; const Section: string; var Result: Longint) of object;
TApplication = class(TComponent)
private
FHandle: HWnd;
FBiDiMode: TBiDiMode;
FBiDiKeyboard: string;
FNonBiDiKeyboard: string;
FObjectInstance: Pointer;
FMainForm: TForm;
FMouseControl: TControl;
FHelpSystem : IHelpSystem;
FHelpFile: string;
FHint: string;
FHintActive: Boolean;
FUpdateFormatSettings: Boolean;
FUpdateMetricSettings: Boolean;
FShowMainForm: Boolean;
FHintColor: TColor;
FHintControl: TControl;
FHintCursorRect: TRect;
FHintHidePause: Integer;
FHintPause: Integer;
FHintShortCuts: Boolean;
FHintShortPause: Integer;
FHintWindow: THintWindow;
FShowHint: Boolean;
FTimerMode: TTimerMode;
FTimerHandle: Word;
FTitle: string;
FTopMostList: TList;
FTopMostLevel: Integer;
FIcon: TIcon;
FTerminate: Boolean;
FActive: Boolean;
FAllowTesting: Boolean;
FTestLib: THandle;
FHandleCreated: Boolean;
FRunning: Boolean;
FWindowHooks: TList;
FWindowList: Pointer;
FDialogHandle: HWnd;
FAutoDragDocking: Boolean;
FModalLevel: Integer;
FOnActionExecute: TActionEvent;
FOnActionUpdate: TActionEvent;
FOnException: TExceptionEvent;
FOnMessage: TMessageEvent;
FOnModalBegin: TNotifyEvent;
FOnModalEnd: TNotifyEvent;
FOnHelp: THelpEvent;
FOnHint: TNotifyEvent;
FOnIdle: TIdleEvent;
FOnDeactivate: TNotifyEvent;
FOnActivate: TNotifyEvent;
FOnMinimize: TNotifyEvent;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -