📄 skinboxctrls.pas
字号:
ItemLeftOffset, ItemRightOffset: Integer;
ItemTextRect: TRect;
FontColor, FocusFontColor: TColor;
ButtonRect,
ActiveButtonRect,
DownButtonRect, UnEnabledButtonRect: TRect;
ListBoxName: String;
ItemStretchEffect, FocusItemStretchEffect: Boolean;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ChangeSkinData; override;
procedure CloseUp(Value: Boolean);
procedure DropDown;
function IsPopupVisible: Boolean;
function CanCancelDropDown: Boolean;
procedure Invalidate; override;
public
property HideSelection: Boolean
read FHideSelection write FHideSelection;
property AutoComplete: Boolean read FAutoComplete write FAutoComplete;
property ListBoxWidth: Integer read FListBoxWidth write FListBoxWidth;
property ListBoxAlphaBlend: Boolean read FListBoxAlphaBlend write FListBoxAlphaBlend;
property ListBoxAlphaBlendAnimation: Boolean
read FListBoxAlphaBlendAnimation write FListBoxAlphaBlendAnimation;
property ListBoxAlphaBlendValue: Byte read FListBoxAlphaBlendValue write FListBoxAlphaBlendValue;
property ListBoxUseSkinItemHeight: Boolean
read GetListBoxUseSkinItemHeight write SetListBoxUseSkinItemHeight;
property Images: TCustomImageList read GetImages write SetImages;
property ImageIndex: Integer read GetImageIndex write SetImageIndex;
property ListBoxCaption: String read GetListBoxCaption
write SetListBoxCaption;
property ListBoxCaptionMode: Boolean read GetListBoxCaptionMode
write SetListBoxCaptionMode;
property ListBoxDefaultFont: TFont
read GetListBoxDefaultFont write SetListBoxDefaultFont;
property ListBoxDefaultCaptionFont: TFont
read GetListBoxDefaultCaptionFont write SetListBoxDefaultCaptionFont;
property ListBoxDefaultItemHeight: Integer
read GetListBoxDefaultItemHeight write SetListBoxDefaultItemHeight;
property ListBoxCaptionAlignment: TAlignment
read GetListBoxCaptionAlignment write SetListBoxCaptionAlignment;
property Enabled;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop default True;
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;
published
property UseSkinSize: Boolean read FUseSkinSize write FUseSkinSize;
end;
TspSkinComboBox = class(TspSkinCustomComboBox)
published
property HideSelection;
property AutoComplete;
property ListBoxUseSkinItemHeight;
property ListBoxAlphaBlend;
property ListBoxAlphaBlendAnimation;
property ListBoxAlphaBlendValue;
property HorizontalExtent;
property Images;
property ImageIndex;
property ListBoxWidth;
property ListBoxCaption;
property ListBoxCaptionMode;
property ListBoxDefaultFont;
property ListBoxDefaultCaptionFont;
property ListBoxDefaultItemHeight;
property ListBoxCaptionAlignment;
property Enabled;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop default True;
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;
TspSkinMRUComboBox = class(TspSkinComboBox)
public
procedure AddMRUItem(Value: String);
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;
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 HideSelection;
property AutoComplete;
property ListBoxWidth;
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;
TspSkinColorListBox = class(TspSkinListBox)
private
FShowNames: Boolean;
FExStyle: TspColorBoxStyle;
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 Loaded; override;
procedure ListBoxKeyDown(var Key: Word; Shift: TShiftState); override;
procedure ListBoxDblClick; override;
public
constructor Create(AOwner: TComponent); override;
property Colors[Index: Integer]: TColor read GetColor;
property ColorNames[Index: Integer]: string read GetColorName;
procedure PopulateList;
published
property Sorted;
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;
TspSkinFontSizeComboBox = class(TspSkinCustomComboBox)
private
PixelsPerInch: Integer;
FFontName: TFontName;
procedure SetFontName(const Value: TFontName);
procedure Build;
function GetSizeValue: Integer;
public
property FontName: TFontName read FFontName write SetFontName;
property SizeValue: Integer read GetSizeValue;
published
property HideSelection;
property AutoComplete;
property AlphaBlend;
property AlphaBlendValue;
property ListBoxWidth;
property ListBoxCaption;
property ListBoxCaptionMode;
property Enabled;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
//
property Align;
property ItemIndex;
property DropDownCount;
property Font;
property Sorted;
property Style;
property OnChange;
property OnClick;
end;
TspSkinFontListBox = class(TspSkinListBox)
protected
FDevice: TspFontDevice;
FUpdate: Boolean;
FUseFonts: Boolean;
FOptions: TspFontListOptions;
procedure ListBoxCreateWnd; override;
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 DrawLBFontItem(Cnvs: TCanvas; Index: Integer;
ItemWidth, ItemHeight: Integer; TextRect: TRect; State: TOwnerDrawState);
procedure DrawTT(Cnvs: TCanvas; X, Y: Integer; C: TColor);
procedure Loaded; override;
public
constructor Create(AOwner: TComponent); override;
procedure PopulateList;
published
property Enabled;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
//
property Align;
property ItemIndex;
property Font;
property Sorted;
//
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;
end;
TspSkinFontComboBox = class(TspSkinCustomComboBox)
protected
FDevice: TspFontDevice;
FUpdate: Boolean;
FUseFonts: Boolean;
FOptions: TspFontListOptions;
procedure SetFontName(const NewFontName: TFontName);
function GetFontName: TFontName;
function GetTrueTypeOnl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -