📄 rxctrls.pas
字号:
FLeftMargin: Integer;
FRightMargin: Integer;
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
procedure DoDrawText(var Rect: TRect; Flags: Word);
function GetTransparent: Boolean;
procedure UpdateTracking;
procedure SetAlignment(Value: TAlignment);
procedure SetFocusControl(Value: TWinControl);
procedure SetLayout(Value: TTextLayout);
procedure SetLeftMargin(Value: Integer);
procedure SetRightMargin(Value: Integer);
procedure SetShadowColor(Value: TColor);
procedure SetShadowSize(Value: Byte);
procedure SetShadowPos(Value: TShadowPosition);
procedure SetShowAccelChar(Value: Boolean);
procedure SetTransparent(Value: Boolean);
procedure SetWordWrap(Value: Boolean);
procedure SetShowFocus(Value: Boolean);
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED;
procedure WMRButtonDown(var Message: TWMRButtonDown); message WM_RBUTTONDOWN;
procedure WMRButtonUp(var Message: TWMRButtonUp); message WM_RBUTTONUP;
protected
procedure SetAutoSize(Value: Boolean); override;
procedure AdjustBounds;
function GetDefaultFontColor: TColor; virtual;
function GetLabelCaption: string; virtual;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure Paint; override;
procedure MouseEnter; dynamic;
procedure MouseLeave; dynamic;
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
property FocusControl: TWinControl read FFocusControl write SetFocusControl;
property Layout: TTextLayout read FLayout write SetLayout default tlTop;
property LeftMargin: Integer read FLeftMargin write SetLeftMargin default 0;
property RightMargin: Integer read FRightMargin write SetRightMargin default 0;
property ShadowColor: TColor read FShadowColor write SetShadowColor default clBtnHighlight;
property ShadowSize: Byte read FShadowSize write SetShadowSize default 1;
property ShadowPos: TShadowPosition read FShadowPos write SetShadowPos default spLeftTop;
property ShowAccelChar: Boolean read FShowAccelChar write SetShowAccelChar default True;
property ShowFocus: Boolean read FShowFocus write SetShowFocus default False;
property Transparent: Boolean read GetTransparent write SetTransparent default False;
property WordWrap: Boolean read FWordWrap write SetWordWrap default False;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
public
constructor Create(AOwner: TComponent); override;
property Canvas;
property MouseInControl: Boolean read FMouseInControl;
end;
{ TRxLabel }
TRxLabel = class(TRxCustomLabel)
published
property Align;
property Alignment;
property AutoSize;
property Caption;
property Color;
property DragCursor;
property DragMode;
property Enabled;
property FocusControl;
property Font;
{$IFDEF RX_D4}
property Anchors;
property BiDiMode;
property Constraints;
property DragKind;
property ParentBiDiMode;
{$ENDIF}
property Layout;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShadowColor;
property ShadowSize;
property ShadowPos;
property ShowAccelChar;
property ShowFocus;
property ShowHint;
property Transparent;
property Visible;
property WordWrap;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseEnter;
property OnMouseLeave;
{$IFDEF WIN32}
property OnStartDrag;
{$ENDIF}
{$IFDEF RX_D5}
property OnContextPopup;
{$ENDIF}
{$IFDEF RX_D4}
property OnEndDock;
property OnStartDock;
{$ENDIF}
end;
{ TSecretPanel }
TGlyphLayout = (glGlyphLeft, glGlyphRight, glGlyphTop, glGlyphBottom);
TScrollDirection = (sdVertical, sdHorizontal);
TPanelDrawEvent = procedure(Sender: TObject; Canvas: TCanvas;
Rect: TRect) of object;
TSecretPanel = class(TCustomPanel)
private
FActive: Boolean;
FAlignment: TAlignment;
FLines: TStrings;
FCycled: Boolean;
FScrollCnt: Integer;
FMaxScroll: Integer;
FTxtDivider: Byte;
FFirstLine: Integer;
FTimer: TRxTimer;
FTxtRect: TRect;
FPaintRect: TRect;
FGlyphOrigin: TPoint;
FMemoryImage: TBitmap;
FGlyph: TBitmap;
FHiddenList: TList;
FTextStyle: TPanelBevel;
FDirection: TScrollDirection;
FGlyphLayout: TGlyphLayout;
FOnPaintClient: TPanelDrawEvent;
FOnStartPlay: TNotifyEvent;
FOnStopPlay: TNotifyEvent;
{$IFDEF RX_D3}
FAsyncDrawing: Boolean;
procedure SetAsyncDrawing(Value: Boolean);
{$ENDIF}
function GetInflateWidth: Integer;
function GetInterval: Cardinal;
procedure SetInterval(Value: Cardinal);
procedure SetGlyph(Value: TBitmap);
procedure SetLines(Value: TStrings);
procedure SetActive(Value: Boolean);
procedure SetAlignment(Value: TAlignment);
procedure SetGlyphLayout(Value: TGlyphLayout);
procedure SetTextStyle(Value: TPanelBevel);
procedure SetDirection(Value: TScrollDirection);
procedure RecalcDrawRect;
procedure PaintGlyph;
procedure PaintText;
procedure UpdateMemoryImage;
procedure GlyphChanged(Sender: TObject);
procedure LinesChanged(Sender: TObject);
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure WMSize(var Message: TMessage); message WM_SIZE;
protected
procedure AlignControls(AControl: TControl; var Rect: TRect); override;
procedure Paint; override;
procedure PaintClient(Canvas: TCanvas; Rect: TRect); virtual;
procedure TimerExpired(Sender: TObject); virtual;
procedure StartPlay; dynamic;
procedure StopPlay; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Play;
procedure Stop;
property Canvas;
published
{$IFDEF RX_D3}
property AsyncDrawing: Boolean read FAsyncDrawing write SetAsyncDrawing default True;
{$ENDIF}
property Active: Boolean read FActive write SetActive default False;
property Alignment: TAlignment read FAlignment write SetAlignment default taCenter;
property Cycled: Boolean read FCycled write FCycled default False;
property Glyph: TBitmap read FGlyph write SetGlyph;
property GlyphLayout: TGlyphLayout read FGlyphLayout write SetGlyphLayout
default glGlyphLeft;
property Interval: Cardinal read GetInterval write SetInterval default 30;
property Lines: TStrings read FLines write SetLines;
property ScrollDirection: TScrollDirection read FDirection write SetDirection
default sdVertical;
property TextStyle: TPanelBevel read FTextStyle write SetTextStyle default bvNone;
{$IFDEF RX_D4}
property Anchors;
property BiDiMode;
property Constraints;
property DragKind;
property ParentBiDiMode;
{$ENDIF}
property Align;
property BevelInner;
property BevelOuter default bvLowered;
property BevelWidth;
property BorderWidth;
property BorderStyle;
property DragCursor;
property DragMode;
property Color;
property Ctl3D;
property Font;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnPaintClient: TPanelDrawEvent read FOnPaintClient write FOnPaintClient;
property OnStartPlay: TNotifyEvent read FOnStartPlay write FOnStartPlay;
property OnStopPlay: TNotifyEvent read FOnStopPlay write FOnStopPlay;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
{$IFDEF WIN32}
property OnStartDrag;
{$ENDIF}
{$IFDEF RX_D5}
property OnContextPopup;
{$ENDIF}
{$IFDEF RX_D4}
property OnEndDock;
property OnStartDock;
{$ENDIF}
property OnResize;
end;
{ TRxSpeedButton }
TRxNumGlyphs = 1..5;
TRxDropDownMenuPos = (dmpBottom, dmpRight);
TRxButtonState = (rbsUp, rbsDisabled, rbsDown, rbsExclusive, rbsInactive);
TRxSpeedButton = class(TGraphicControl)
private
FGroupIndex: Integer;
FStyle: TButtonStyle;
FGlyph: Pointer;
FDrawImage: TBitmap;
FDown: Boolean;
FDragging: Boolean;
FFlat: Boolean;
FMouseInControl: Boolean;
FAllowAllUp: Boolean;
FLayout: TButtonLayout;
FSpacing: Integer;
FMargin: Integer;
FModalResult: TModalResult;
FTransparent: Boolean;
FMarkDropDown: Boolean;
FDropDownMenu: TPopupMenu;
FMenuPosition: TRxDropDownMenuPos;
FInactiveGrayed: Boolean;
FMenuTracking: Boolean;
FRepeatTimer: TTimer;
FAllowTimer: Boolean;
FInitRepeatPause: Word;
FRepeatPause: Word;
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
procedure GlyphChanged(Sender: TObject);
procedure UpdateExclusive;
function GetGlyph: TBitmap;
procedure SetGlyph(Value: TBitmap);
function GetNumGlyphs: TRxNumGlyphs;
procedure SetNumGlyphs(Value: TRxNumGlyphs);
function GetWordWrap: Boolean;
procedure SetWordWrap(Value: Boolean);
function GetAlignment: TAlignment;
procedure SetAlignment(Value: TAlignment);
procedure SetDown(Value: Boolean);
procedure SetAllowAllUp(Value: Boolean);
procedure SetGroupIndex(Value: Integer);
procedure SetLayout(Value: TButtonLayout);
procedure SetSpacing(Value: Integer);
procedure SetMargin(Value: Integer);
procedure SetDropDownMenu(Value: TPopupMenu);
procedure SetFlat(Value: Boolean);
procedure SetStyle(Value: TButtonStyle);
procedure SetInactiveGrayed(Value: Boolean);
procedure SetTransparent(Value: Boolean);
procedure SetMarkDropDown(Value: Boolean);
procedure TimerExpired(Sender: TObject);
procedure SetAllowTimer(Value: Boolean);
function CheckMenuDropDown(const Pos: TSmallPoint;
Manual: Boolean): Boolean;
procedure DoMouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
procedure CMButtonPressed(var Message: TMessage); message CM_RXBUTTONPRESSED;
procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED;
procedure WMLButtonDblClk(var Message: TWMLButtonDown); message WM_LBUTTONDBLCLK;
procedure WMMouseMove(var Message: TMessage); message WM_MOUSEMOVE;
procedure WMRButtonDown(var Message: TWMRButtonDown); message WM_RBUTTONDOWN;
procedure WMRButtonUp(var Message: TWMRButtonUp); message WM_RBUTTONUP;
protected
FState: TRxButtonState;
{$IFDEF RX_D4}
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
{$ENDIF}
function GetDropDownMenuPos: TPoint;
function GetPalette: HPALETTE; override;
procedure Paint; override;
procedure Loaded; override;
procedure PaintGlyph(Canvas: TCanvas; ARect: TRect; AState: TRxButtonState;
DrawMark: Boolean); virtual;
procedure MouseEnter; dynamic;
procedure MouseLeave; dynamic;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
property ButtonGlyph: Pointer read FGlyph;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ButtonClick;
function CheckBtnMenuDropDown: Boolean;
procedure Click; override;
procedure UpdateTracking;
published
{$IFDEF RX_D4}
property Action;
property Anchors;
property BiDiMode;
property Constraints;
property DragKind;
property ParentBiDiMode;
{$ENDIF}
property Alignment: TAlignment read GetAlignment write SetAlignment default taCenter;
property AllowAllUp: Boolean read FAllowAllUp write SetAllowAllUp default False;
property AllowTimer: Boolean read FAllowTimer write SetAllowTimer default False;
property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0;
{ Ensure group index is declared before Down }
property Down: Boolean read FDown write SetDown default False;
property DropDownMenu: TPopupMenu read FDropDownMenu write SetDropDownMenu;
property MenuPosition: TRxDropDownMenuPos read FMenuPosition write FMenuPosition
default dmpBottom;
property Caption;
property DragCursor;
property DragMode;
property Enabled;
property Flat: Boolean read FFlat write SetFlat default False;
property Font;
property Glyph: TBitmap read GetGlyph write SetGlyph;
property GrayedInactive: Boolean read FInactiveGrayed write SetInactiveGrayed
default True;
property InitPause: Word read FInitRepeatPause write FInitRepeatPause default 500;
property Layout: TButtonLayout read FLayout write SetLayout default blGlyphTop;
property Margin: Integer read FMargin write SetMargin default -1;
property MarkDropDown: Boolean read FMarkDropDown write SetMarkDropDown default True;
property ModalResult: TModalResult read FModalResult write FModalResult default 0;
property NumGlyphs: TRxNumGlyphs read GetNumGlyphs write SetNumGlyphs default 1;
property ParentFont;
property ParentShowHint default False;
property RepeatInterval: Word read FRepeatPause write FRepeatPause default 100;
property ShowHint default True;
property Spacing: Integer read FSpacing write SetSpacing default 1;
property Style: TButtonStyle read FStyle write SetStyle default bsAutoDetect;
property Transparent: Boolean read FTransparent write SetTransparent default False;
property WordWrap: Boolean read GetWordWrap write SetWordWrap default False;
property Visible;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
{$IFDEF WIN32}
property OnStartDrag;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -