📄 forms.pas
字号:
{*******************************************************}
{ }
{ Borland Delphi Visual Component Library }
{ }
{ Copyright (c) 1995-2002 Borland Software Corporation }
{ }
{*******************************************************}
unit Forms;
{$P+,S-,W-,R-,T-,H+,X+}
{$C PRELOAD}
{$WARN SYMBOL_PLATFORM OFF}
interface
{$IFDEF LINUX}
uses WinUtils, Messages, Libc, Windows, SysUtils, Classes, Graphics, Menus,
Controls, Imm, ActnList, MultiMon, HelpIntfs;
{$ENDIF}
{$IFDEF MSWINDOWS}
uses Messages, Windows, SysUtils, Classes, Graphics, Menus, Controls, Imm,
ActnList, MultiMon, HelpIntfs;
{$ENDIF}
type
{ Forward declarations }
TScrollingWinControl = class;
TCustomForm = class;
TForm = class;
TMonitor = class;
{ TControlScrollBar }
TScrollBarKind = (sbHorizontal, sbVertical);
TScrollBarInc = 1..32767;
TScrollBarStyle = (ssRegular, ssFlat, ssHotTrack);
TControlScrollBar = class(TPersistent)
private
FControl: TScrollingWinControl;
FIncrement: TScrollBarInc;
FPageIncrement: TScrollbarInc;
FPosition: Integer;
FRange: Integer;
FCalcRange: Integer;
FKind: TScrollBarKind;
FMargin: Word;
FVisible: Boolean;
FTracking: Boolean;
FScaled: Boolean;
FSmooth: Boolean;
FDelay: Integer;
FButtonSize: Integer;
FColor: TColor;
FParentColor: Boolean;
FSize: Integer;
FStyle: TScrollBarStyle;
FThumbSize: Integer;
FPageDiv: Integer;
FLineDiv: Integer;
FUpdateNeeded: Boolean;
constructor Create(AControl: TScrollingWinControl; AKind: TScrollBarKind);
procedure CalcAutoRange;
function ControlSize(ControlSB, AssumeSB: Boolean): Integer;
procedure DoSetRange(Value: Integer);
function GetScrollPos: Integer;
function NeedsScrollBarVisible: Boolean;
function IsIncrementStored: Boolean;
procedure ScrollMessage(var Msg: TWMScroll);
procedure SetButtonSize(Value: Integer);
procedure SetColor(Value: TColor);
procedure SetParentColor(Value: Boolean);
procedure SetPosition(Value: Integer);
procedure SetRange(Value: Integer);
procedure SetSize(Value: Integer);
procedure SetStyle(Value: TScrollBarStyle);
procedure SetThumbSize(Value: Integer);
procedure SetVisible(Value: Boolean);
function IsRangeStored: Boolean;
procedure Update(ControlSB, AssumeSB: Boolean);
public
procedure Assign(Source: TPersistent); override;
procedure ChangeBiDiPosition;
property Kind: TScrollBarKind read FKind;
function IsScrollBarVisible: Boolean;
property ScrollPos: Integer read GetScrollPos;
published
property ButtonSize: Integer read FButtonSize write SetButtonSize default 0;
property Color: TColor read FColor write SetColor default clBtnHighlight;
property Increment: TScrollBarInc read FIncrement write FIncrement stored IsIncrementStored default 8;
property Margin: Word read FMargin write FMargin default 0;
property ParentColor: Boolean read FParentColor write SetParentColor default True;
property Position: Integer read FPosition write SetPosition default 0;
property Range: Integer read FRange write SetRange stored IsRangeStored default 0;
property Smooth: Boolean read FSmooth write FSmooth default False;
property Size: Integer read FSize write SetSize default 0;
property Style: TScrollBarStyle read FStyle write SetStyle default ssRegular;
property ThumbSize: Integer read FThumbSize write SetThumbSize default 0;
property Tracking: Boolean read FTracking write FTracking default False;
property Visible: Boolean read FVisible write SetVisible default True;
end;
{ TScrollingWinControl }
TWindowState = (wsNormal, wsMinimized, wsMaximized);
TScrollingWinControl = class(TWinControl)
private
FHorzScrollBar: TControlScrollBar;
FVertScrollBar: TControlScrollBar;
FAutoScroll: Boolean;
FAutoRangeCount: Integer;
FUpdatingScrollBars: Boolean;
procedure CalcAutoRange;
procedure ScaleScrollBars(M, D: Integer);
procedure SetAutoScroll(Value: Boolean);
procedure SetHorzScrollBar(Value: TControlScrollBar);
procedure SetVertScrollBar(Value: TControlScrollBar);
procedure UpdateScrollBars;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure WMHScroll(var Message: TWMHScroll); message WM_HSCROLL;
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
procedure CMBiDiModeChanged(var Message: TMessage); message CM_BIDIMODECHANGED;
protected
procedure AdjustClientRect(var Rect: TRect); override;
procedure AlignControls(AControl: TControl; var ARect: TRect); override;
function AutoScrollEnabled: Boolean; virtual;
procedure AutoScrollInView(AControl: TControl); virtual;
procedure ChangeScale(M, D: Integer); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure DoFlipChildren; override;
property AutoScroll: Boolean read FAutoScroll write SetAutoScroll default True;
procedure Resizing(State: TWindowState); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DisableAutoRange;
procedure EnableAutoRange;
procedure ScrollInView(AControl: TControl);
published
property HorzScrollBar: TControlScrollBar read FHorzScrollBar write SetHorzScrollBar;
property VertScrollBar: TControlScrollBar read FVertScrollBar write SetVertScrollBar;
end;
{ TScrollBox }
TFormBorderStyle = (bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow,
bsSizeToolWin);
TBorderStyle = bsNone..bsSingle;
TScrollBox = class(TScrollingWinControl)
private
FBorderStyle: TBorderStyle;
procedure SetBorderStyle(Value: TBorderStyle);
procedure WMNCHitTest(var Message: TMessage); message WM_NCHITTEST;
procedure CMCtl3DChanged(var Message: TMessage); message CM_CTL3DCHANGED;
protected
procedure CreateParams(var Params: TCreateParams); override;
public
constructor Create(AOwner: TComponent); override;
published
property Align;
property Anchors;
property AutoScroll;
property AutoSize;
property BevelEdges;
property BevelInner;
property BevelOuter;
property BevelKind;
property BevelWidth;
property BiDiMode;
property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Color nodefault;
property Ctl3D;
property Font;
property ParentBiDiMode;
property ParentBackground default False;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDblClick;
property OnDockDrop;
property OnDockOver;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
{ TCustomFrame }
TCustomFrame = class(TScrollingWinControl)
private
procedure AddActionList(ActionList: TCustomActionList);
procedure RemoveActionList(ActionList: TCustomActionList);
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure SetParent(AParent: TWinControl); override;
public
constructor Create(AOwner: TComponent); override;
end;
TCustomFrameClass = class of TCustomFrame;
{ TFrame }
TFrame = class(TCustomFrame)
published
property Align;
property Anchors;
property AutoScroll;
property AutoSize;
property BiDiMode;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Color nodefault;
property Ctl3D;
property Font;
property ParentBackground default True;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDblClick;
property OnDockDrop;
property OnDockOver;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
{ IDesignerHook }
IDesignerHook = interface(IDesignerNotify)
['{1E431DA5-2BEA-4DE7-A330-CC45FD2FB1EC}']
function GetCustomForm: TCustomForm;
procedure SetCustomForm(Value: TCustomForm);
function GetIsControl: Boolean;
procedure SetIsControl(Value: Boolean);
function IsDesignMsg(Sender: TControl; var Message: TMessage): Boolean;
procedure PaintGrid;
procedure ValidateRename(AComponent: TComponent;
const CurName, NewName: string);
function UniqueName(const BaseName: string): string;
function GetRoot: TComponent;
property IsControl: Boolean read GetIsControl write SetIsControl;
property Form: TCustomForm read GetCustomForm write SetCustomForm;
end;
{ IOleForm }
IOleForm = interface
['{CD02E1C1-52DA-11D0-9EA6-0020AF3D82DA}']
procedure OnDestroy;
procedure OnResize;
end;
{ TCustomForm }
TFormStyle = (fsNormal, fsMDIChild, fsMDIForm, fsStayOnTop);
TBorderIcon = (biSystemMenu, biMinimize, biMaximize, biHelp);
TBorderIcons = set of TBorderIcon;
TPosition = (poDesigned, poDefault, poDefaultPosOnly, poDefaultSizeOnly,
poScreenCenter, poDesktopCenter, poMainFormCenter, poOwnerFormCenter);
TDefaultMonitor = (dmDesktop, dmPrimary, dmMainForm, dmActiveForm);
TPrintScale = (poNone, poProportional, poPrintToFit);
TShowAction = (saIgnore, saRestore, saMinimize, saMaximize);
TTileMode = (tbHorizontal, tbVertical);
TCloseAction = (caNone, caHide, caFree, caMinimize);
TCloseEvent = procedure(Sender: TObject; var Action: TCloseAction) of object;
TCloseQueryEvent = procedure(Sender: TObject;
var CanClose: Boolean) of object;
TFormState = set of (fsCreating, fsVisible, fsShowing, fsModal,
fsCreatedMDIChild, fsActivated);
TShortCutEvent = procedure (var Msg: TWMKey; var Handled: Boolean) of object;
THelpEvent = function(Command: Word; Data: Longint;
var CallHelp: Boolean): Boolean of object;
TCustomForm = class(TScrollingWinControl)
private
FActiveControl: TWinControl;
FFocusedControl: TWinControl;
FBorderIcons: TBorderIcons;
FBorderStyle: TFormBorderStyle;
FSizeChanging: Boolean;
FWindowState: TWindowState;
FShowAction: TShowAction;
FKeyPreview: Boolean;
FActive: Boolean;
FFormStyle: TFormStyle;
FPosition: TPosition;
FDefaultMonitor: TDefaultMonitor;
FTileMode: TTileMode;
FDropTarget: Boolean;
FOldCreateOrder: Boolean;
FPrintScale: TPrintScale;
FCanvas: TControlCanvas;
FHelpFile: string;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -