📄 skinboxctrls.pas
字号:
property ShowHint;
property TabOrder;
property Visible;
//
property Text;
property Align;
property Items: TStrings read GetItems write SetItems;
property ItemIndex: Integer read GetItemIndex write SetItemIndex;
property DropDownCount: Integer read FDropDownCount write SetDropDownCount;
property HorizontalExtent: Boolean
read GetHorizontalExtent write SetHorizontalExtent;
property Font;
property Sorted: boolean read GetSorted write SetSorted;
property Style: TspSkinCustomComboBoxStyle read FStyle write SetStyle;
property SelStart: Integer read GetSelStart write SetSelStart;
property SelLength: Integer read GetSelLength write SetSelLength;
property OnListBoxDrawItem: TspDrawSkinItemEvent
read FOnListBoxDrawItem write SetListBoxDrawItem;
property OnComboBoxDrawItem: TspDrawSkinItemEvent
read FOnComboBoxDrawItem write FOnComboBoxDrawItem;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnClick: TNotifyEvent read FOnClick write FOnClick;
property OnCloseUp: TNotifyEvent read FOnCloseUp write FOnCloseUp;
property OnDropDown: TNotifyEvent read FOnDropDown write FOnDropDown;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnEnter;
property OnExit;
end;
TspSkinComboBox = class(TspSkinCustomComboBox)
published
property AutoComplete;
property ListBoxUseSkinItemHeight;
property ListBoxAlphaBlend;
property ListBoxAlphaBlendAnimation;
property ListBoxAlphaBlendValue;
property TabStop;
property HorizontalExtent;
property Images;
property ImageIndex;
property ListBoxCaption;
property ListBoxCaptionMode;
property ListBoxDefaultFont;
property ListBoxDefaultCaptionFont;
property ListBoxDefaultItemHeight;
property ListBoxCaptionAlignment;
property Enabled;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
//
property Text;
property Align;
property Items;
property ItemIndex;
property DropDownCount;
property Font;
property Sorted;
property Style;
property OnListBoxDrawItem;
property OnComboBoxDrawItem;
property OnChange;
property OnClick;
property OnCloseUp;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnEnter;
property OnExit;
property OnDropDown;
end;
TspColorBoxStyles = (spcbStandardColors, // first sixteen RGBI colors
spcbExtendedColors, // four additional reserved colors
spcbSystemColors, // system managed/defined colors
spcbIncludeNone, // include clNone color, must be used with cbSystemColors
spcbIncludeDefault, // include clDefault color, must be used with cbSystemColors
spcbCustomColor, // first color is customizable
spcbPrettyNames); // instead of 'clColorNames' you get 'Color Names'
TspColorBoxStyle = set of TspColorBoxStyles;
TspSkinColorComboBox = class(TspSkinCustomComboBox)
private
FShowNames: Boolean;
FExStyle: TspColorBoxStyle;
FNeedToPopulate: Boolean;
FListSelected: Boolean;
FDefaultColorColor: TColor;
FNoneColorColor: TColor;
FSelectedColor: TColor;
procedure SetShowNames(Value: Boolean);
function GetColor(Index: Integer): TColor;
function GetColorName(Index: Integer): string;
function GetSelected: TColor;
procedure SetSelected(const AColor: TColor);
procedure ColorCallBack(const AName: string);
procedure SetDefaultColorColor(const Value: TColor);
procedure SetNoneColorColor(const Value: TColor);
procedure SetExStyle(AStyle: TspColorBoxStyle);
protected
procedure DrawColorItem(Cnvs: TCanvas; Index: Integer;
ItemWidth, ItemHeight: Integer; TextRect: TRect; State: TOwnerDrawState);
procedure CreateWnd; override;
function PickCustomColor: Boolean; virtual;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure OnLBCloseUp(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
procedure PopulateList;
property Colors[Index: Integer]: TColor read GetColor;
property ColorNames[Index: Integer]: string read GetColorName;
published
property AutoComplete;
property ListBoxCaption;
property ListBoxCaptionMode;
property ListBoxAlphaBlend;
property ListBoxAlphaBlendValue;
property ListBoxAlphaBlendAnimation;
property Enabled;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
//
property Align;
property ItemIndex;
property DropDownCount;
property Font;
property Sorted;
property OnChange;
property OnClick;
//
property ExStyle: TspColorBoxStyle read FExStyle write SetExStyle
default [spcbStandardColors, spcbExtendedColors, spcbSystemColors];
property Selected: TColor read GetSelected write SetSelected default clBlack;
property DefaultColorColor: TColor read FDefaultColorColor write SetDefaultColorColor default clBlack;
property NoneColorColor: TColor read FNoneColorColor write SetNoneColorColor default clBlack;
property ShowNames: Boolean read FShowNames write SetShowNames;
end;
TspFontDevice = (fdScreen, fdPrinter, fdBoth);
TspFontListOption = (foAnsiOnly, foTrueTypeOnly, foFixedPitchOnly,
foNoOEMFonts, foOEMFontsOnly, foScalableOnly, foNoSymbolFonts);
TspFontListOptions = set of TspFontListOption;
TspSkinFontComboBox = class(TspSkinCustomComboBox)
protected
FDevice: TspFontDevice;
FUpdate: Boolean;
FUseFonts: Boolean;
FOptions: TspFontListOptions;
procedure SetFontName(const NewFontName: TFontName);
function GetFontName: TFontName;
function GetTrueTypeOnly: Boolean;
procedure SetDevice(Value: TspFontDevice);
procedure SetOptions(Value: TspFontListOptions);
procedure SetTrueTypeOnly(Value: Boolean);
procedure SetUseFonts(Value: Boolean);
procedure Reset;
procedure WMFontChange(var Message: TMessage); message WM_FONTCHANGE;
procedure DrawLBFontItem(Cnvs: TCanvas; Index: Integer;
ItemWidth, ItemHeight: Integer; TextRect: TRect; State: TOwnerDrawState);
procedure DrawCBFontItem(Cnvs: TCanvas; Index: Integer;
ItemWidth, ItemHeight: Integer; TextRect: TRect; State: TOwnerDrawState);
procedure CreateWnd; override;
procedure DrawTT(Cnvs: TCanvas; X, Y: Integer; C: TColor);
public
constructor Create(AOwner: TComponent); override;
procedure PopulateList;
published
property AutoComplete;
property ListBoxCaption;
property ListBoxCaptionMode;
property Enabled;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
property Device: TspFontDevice read FDevice write SetDevice default fdScreen;
property FontName: TFontName read GetFontName write SetFontName;
property Options: TspFontListOptions read FOptions write SetOptions default [];
property TrueTypeOnly: Boolean read GetTrueTypeOnly write SetTrueTypeOnly
stored False;
property UseFonts: Boolean read FUseFonts write SetUseFonts default False;
property Align;
property ItemIndex;
property DropDownCount;
property Font;
property Sorted;
property Style;
property OnChange;
property OnClick;
end;
TspValueType = (vtInteger, vtFloat);
TspSkinSpinEdit = class(TspSkinCustomControl)
private
FMouseIn: Boolean;
FEditFocused: Boolean;
StopCheck: Boolean;
FDecimal: Byte;
FMinValue, FMaxValue, FIncrement: Double;
FromEdit: Boolean;
FValueType: TspValueType;
FOnChange: TNotifyEvent;
FValue: Double;
OldActiveButton, ActiveButton, CaptureButton: Integer;
TimerMode: Integer;
WaitMode: Boolean;
procedure StartTimer;
procedure StopTimer;
procedure SetValue(AValue: Double);
procedure SetMinValue(AValue: Double);
procedure SetMaxValue(AValue: Double);
procedure SetEditorEnabled(AValue: Boolean);
function GetEditorEnabled: Boolean;
procedure SetMaxLength(AValue: Integer);
function GetMaxLength: Integer;
procedure SetValueType(NewType: TspValueType);
procedure SetDecimal(NewValue: Byte);
protected
Buttons: array[0..1] of TspCBButtonX;
FOnEditKeyDown: TKeyEvent;
FOnEditKeyPress: TKeyPressEvent;
FOnEditKeyUp: TKeyEvent;
FOnEditEnter: TNotifyEvent;
FOnEditExit: TNotifyEvent;
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); virtual;
procedure EditKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); virtual;
procedure EditKeyPress(Sender: TObject; var Key: Char); virtual;
procedure EditEnter(Sender: TObject); virtual;
procedure EditExit(Sender: TObject); virtual;
procedure EditMouseEnter(Sender: TObject);
procedure EditMouseLeave(Sender: TObject);
procedure UpClick(Sender: TObject);
procedure DownClick(Sender: TObject);
function CheckValue (NewValue: Double): Double;
procedure EditChange(Sender: TObject);
procedure ButtonDown(I: Integer; X, Y: Integer);
procedure ButtonUp(I: Integer; X, Y: Integer);
procedure ButtonEnter(I: Integer);
procedure ButtonLeave(I: Integer);
procedure TestActive(X, Y: Integer);
procedure CalcRects;
procedure DrawButton(Cnvs: TCanvas; i: Integer);
procedure CMEnabledChanged(var Msg: TMessage); message CM_ENABLEDCHANGED;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED;
procedure WMSIZE(var Message: TWMSIZE); message WM_SIZE;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
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 GetSkinData; override;
procedure DefaultFontChange; override;
procedure CreateControlDefaultImage(B: TBitMap); override;
procedure CreateControlSkinImage(B: TBitMap); override;
procedure Change; virtual;
public
ActiveSkinRect: TRect;
FontName: String;
FontStyle: TFontStyles;
FontHeight: Integer;
FontColor, DisabledFontColor, ActiveFontColor: TColor;
UpButtonRect, ActiveUpButtonRect, DownUpButtonRect: TRect;
DownButtonRect, ActiveDownButtonRect, DownDownButtonRect: TRect;
LOffset, ROffset: Integer;
//
FEdit: TspSkinNumEdit;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Invalidate; override;
function IsNumText(AText: String): Boolean;
procedure ChangeSkinData; override;
property Text;
procedure SimpleSetValue(AValue: Double);
published
property Enabled;
property ValueType: TspValueType read FValueType write SetValueType;
property Decimal: Byte read FDecimal write SetDecimal default 2;
property Align;
property MinValue: Double read FMinValue write SetMinValue;
property MaxValue: Double read FMaxValue write SetMaxValue;
property Value: Double read FValue write SetValue;
property Increment: Double read FIncrement write FIncrement;
property EditorEnabled: Boolean read GetEditorEnabled write SetEditorEnabled;
property MaxLength: Integer read GetMaxLength write SetMaxLength;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnEditKeyDown: TKeyEvent read FOnEditKeyDown write FOnEditKeyDown;
property OnEditKeyPress: TKeyPressEvent read FOnEditKeyPress write FOnEditKeyPress;
property OnEditKeyUp: TKeyEvent read FOnEditKeyUp write FOnEditKeyUp;
property OnEditEnter: TNotifyEvent read FOnEditEnter write FOnEditEnter;
property OnEditExit: TNotifyEvent read FOnEditExit write FOnEditExit;
end;
TspSkinNumericEdit = class(TspSkinCustomEdit)
private
StopCheck, FromEdit: Boolean;
FMinValue, FMaxValue, FValue: Double;
FDecimal: Byte;
FValueType: TspValueType;
procedure SetValue(AValue: Double);
procedure SetMinValue(AValue: Double);
procedure SetMaxValue(AValue: Double);
procedure SetDecimal(NewValue: Byte);
procedure SetValueType(NewType: TspValueType);
protected
function CheckValue(NewValue: Double): Double;
procedure KeyPress(var Key: Char); override;
function IsValidChar(Key: Char): Boolean;
procedure Change; override;
property Text
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -