📄 skinctrls.pas
字号:
FAutoSize: Boolean;
FLayout: TTextLayout;
FWordWrap: Boolean;
procedure SetSkinData(Value: TspSkinData);
procedure SetDefaultFont(Value: TFont);
procedure SetLines(Value: TStrings);
procedure SetAlignment(Value: TAlignment);
procedure SetLayout(Value: TTextLayout);
procedure SetWordWrap(Value: Boolean);
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
protected
procedure AdjustBounds; dynamic;
function GetLabelText: string; virtual;
procedure Loaded; override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure SetAutoSize(Value: Boolean); virtual;
procedure DoDrawText(var Rect: TRect; Flags: Longint);
public
FontName: String;
FontStyle: TFontStyles;
FontHeight: Integer;
FontColor: TColor;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Canvas;
procedure ChangeSkinData;
procedure GetSkinData;
procedure Paint; override;
published
property UseSkinFont: Boolean read FUseSkinFont write FUseSkinFont;
property Lines: TStrings read FLines write SetLines;
property DefaultFont: TFont read FDefaultFont write SetDefaultFont;
property SkinData: TspSkinData read FSD write SetSkinData;
property SkinDataName: String read FSkinDataName write FSkinDataName;
property Font;
property Align;
property Alignment: TAlignment read FAlignment write SetAlignment
default taLeftJustify;
property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
property Layout: TTextLayout read FLayout write SetLayout default tlTop;
property WordWrap: Boolean read FWordWrap write SetWordWrap default False;
property Anchors;
property BiDiMode;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property ParentBiDiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
TspSkinStdLabel = class(TCustomLabel)
protected
FIndex: Integer;
FSD: TspSkinData;
FSkinDataName: String;
FDefaultFont: TFont;
FUseSkinFont: Boolean;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure SetSkinData(Value: TspSkinData);
procedure SetDefaultFont(Value: TFont);
property Transparent;
procedure DoDrawText(var Rect: TRect; Flags: Longint); override;
public
FontName: String;
FontStyle: TFontStyles;
FontHeight: Integer;
FontColor: TColor;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure GetSkinData;
procedure ChangeSkinData;
published
property UseSkinFont: Boolean read FUseSkinFont write FUseSkinFont;
property DefaultFont: TFont read FDefaultFont write SetDefaultFont;
property SkinData: TspSkinData read FSD write SetSkinData;
property SkinDataName: String read FSkinDataName write FSkinDataName;
property Font;
property Align;
property Alignment;
property Anchors;
property AutoSize;
property BiDiMode;
property Caption;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FocusControl;
property ParentBiDiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowAccelChar;
property ShowHint;
property Layout;
property Visible;
property WordWrap;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
TspSkinLabel = class(TspSkinCustomControl)
protected
FAlignment: TAlignment;
FAutoSize: Boolean;
FBorderStyle: TspSkinBorderStyle;
procedure SetBorderStyle(Value: TspSkinBorderStyle);
procedure DrawLabelText(Cnvs: TCanvas; R: TRect);
function CalcWidthOffset: Integer; virtual;
procedure AdjustBounds;
procedure PaintLabel(B: TBitMap);
procedure SetAutoSizeX(Value: Boolean);
procedure SetAlignment(Value: TAlignment);
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure CalcSize(var W, H: Integer); override;
procedure GetSkinData; override;
procedure CreateControlDefaultImage(B: TBitMap); override;
procedure CreateControlSkinImage(B: TBitMap); override;
public
FontName: String;
FontStyle: TFontStyles;
FontHeight: Integer;
FontColor: TColor;
constructor Create(AOwner: TComponent); override;
published
property BorderStyle: TspSkinBorderStyle
read FBorderStyle write SetBorderStyle;
property Alignment: TAlignment read FAlignment write SetAlignment
default taLeftJustify;
property Align;
property Caption;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property PopupMenu;
property ShowHint;
property Visible;
property AutoSize: Boolean read FAutoSize write SetAutoSizeX;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
TspSkinBitLabel = class(TspSkinCustomControl)
protected
FAutoSize: Boolean;
FFixLength: Integer;
function GetFixWidth: Integer;
procedure SetFixLength(Value: Integer);
procedure AdjustBounds;
procedure GetSkinData; override;
procedure PaintLabel(B: TBitMap);
procedure CalcSize(var W, H: Integer); override;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure CreateControlDefaultImage(B: TBitMap); override;
procedure CreateControlSkinImage(B: TBitMap); override;
public
SkinTextRect: TRect;
SymbolWidth: Integer;
SymbolHeight: Integer;
Symbols: TStrings;
procedure SetAutoSizeX(Value: Boolean);
constructor Create(AOwner: TComponent); override;
published
property Caption;
property AutoSize: Boolean read FAutoSize write SetAutoSizeX;
property FixLength: Integer read FFixLength write SetFixLength;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
TspSkinTrackBar = class(TspSkinCustomControl)
protected
FClicksDisabled: Boolean;
FCanFocused: Boolean;
Offset1, Offset2, BOffset: Integer;
BR: TRect;
FMinValue, FMaxValue, FValue: Integer;
FVertical: Boolean;
FMouseSupport, FDown: Boolean;
OMPos: Integer;
OldBOffset: Integer;
FOnChange: TNotifyEvent;
FJumpWhenClick: Boolean;
function IsFocused: Boolean;
procedure SetCanFocused(Value: Boolean);
procedure SetVertical(AValue: Boolean);
procedure SetMinValue(AValue: Integer);
procedure SetMaxValue(AValue: Integer);
procedure SetValue(AValue: Integer);
procedure GetSkinData; override;
procedure CreateImage(B: TBitMap);
procedure CalcSize(var W, H: Integer); override;
function CalcButtonRect(R: TRect; AV: Boolean): TRect;
function CalcValue(AOffset: Integer): Integer;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure WMMOUSEWHEEL(var Message: TMessage); message WM_MOUSEWHEEL;
procedure WMSETFOCUS(var Message: TWMSETFOCUS); message WM_SETFOCUS;
procedure WMKILLFOCUS(var Message: TWMKILLFOCUS); message WM_KILLFOCUS;
procedure WndProc(var Message: TMessage); override;
procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey); message CM_WANTSPECIALKEY;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure CreateControlDefaultImage(B: TBitMap); override;
procedure CreateControlSkinImage(B: TBitMap); override;
public
TrackArea, NewTrackArea, ButtonRect, ActiveButtonRect: TRect;
constructor Create(AOwner: TComponent); override;
published
property JumpWhenClick: Boolean read FJumpWhenClick write FJumpWhenClick;
property PopupMenu;
property ShowHint;
property TabStop;
property TabOrder;
property CanFocused: Boolean read FCanFocused write SetCanFocused;
property MouseSupport: Boolean read FMouseSupport write FMouseSupport;
property MinValue: Integer read FMinValue write SetMinValue;
property MaxValue: Integer read FMaxValue write SetMaxValue;
property Value: Integer read FValue write SetValue;
property Vertical: Boolean read FVertical write SetVertical;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property Align;
property Enabled;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
end;
TspSkinScrollBar = class(TspSkinCustomControl)
private
FNormalSkinDataName: String;
FBothSkinDataName: String;
Offset1, Offset2, BOffset: Integer;
NewTrackArea: TRect;
FDown: Boolean;
OMPos, OldPosition, FScrollWidth: Integer;
OldBOffset: Integer;
WaitMode: Boolean;
MX, MY: Integer;
MouseD: Boolean;
protected
FBothMarkerWidth: Integer;
FClicksDisabled: Boolean;
FCanFocused: Boolean;
FOnChange: TNotifyEvent;
FOnLastChange: TNotifyEvent;
FOnUpButtonClick: TNotifyEvent;
FOnDownButtonClick: TNotifyEvent;
FOnPageUp: TNotifyEvent;
FOnPageDown: TNotifyEvent;
TimerMode: Integer;
ActiveButton, OldActiveButton, CaptureButton: Integer;
Buttons: array[0..2] of TspControlButton;
FMin, FMax, FSmallChange,
FLargeChange, FPosition: Integer;
FKind: TScrollBarKind;
FPageSize: Integer;
procedure SetBothMarkerWidth(Value: Integer);
function IsFocused: Boolean;
procedure SetCanFocused(Value: Boolean);
procedure TestActive(X, Y: Integer);
procedure SetPageSize(AValue: Integer);
procedure ButtonDown(I: Integer; X, Y: Integer);
procedure ButtonUp(I: Integer; X, Y: Integer);
procedure ButtonEnter(I: Integer);
procedure ButtonLeave(I: Integer);
procedure CalcRects;
function CalcValue(AOffset: Integer): Integer;
procedure SetKind(AValue: TScrollBarKind);
procedure SetPosition(AValue: Integer);
procedure SetMin(AValue: Integer);
procedure SetMax(AValue: Integer);
procedure SetSmallChange(AValue: Integer);
procedure SetLargeChange(AValue: Integer);
procedure SetBoth(Value: Boolean);
procedure CalcSize(var W, H: Integer); override;
procedure GetSkinData; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure WMTimer(var Message: TWMTimer); message WM_Timer;
procedure StartScroll;
procedure StopTimer;
procedure DrawButton(Cnvs: TCanvas; i: Integer);
procedure WMMOUSEWHEEL(var Message: TMessage); message WM_MOUSEWHEEL;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure WMSETFOCUS(var Message: TWMSETFOCUS); message WM_SETFOCUS;
procedure WMKILLFOCUS(var Message: TWMKILLFOCUS); message WM_KILLFOCUS;
procedure WndProc(var Message: TMessage); override;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -