📄 dcoutpanel.pas
字号:
FOutHeader:TDCCustomOutHeader;
FOutHeaderNotify:Boolean;
FPinCaption:TCaption;
FRightButton:TDCHotButton;
FVersion:TDCVersion;
Procedure DrawHeader;
Procedure CalcInternalHeaderHeight;
Function GetArrowButtonDown:Boolean;
Function GetBitmap:TBitmap;
Function GetButtonDown:Boolean;
Function GetButtonDownGlyph:TBitmap;
Function GetButtonInCaption:Boolean;
Function GetButtonType:TButtonType;
Function GetButtonUpGlyph:TBitmap;
Function GetDropDownMenu:TPopupMenu;
Function GetHeaderFont:TFont;
Function GetHeaderRect:TRect;
Function GetImageAlignment:TImageAlignment;
Function GetImageIndex:Integer;
Function GetImageList:TImageList;
Function GetOnLeftButtonClick:TNotifyEvent;
Function GetOnRightButtonClick:TNotifyEvent;
Function GetSeparateArrow:Boolean;
Function GetTrackMouse:Boolean;
Procedure OnHeaderFontChange(Sender:TObject);
Procedure SetArrowButtonDown(Value:Boolean);
Procedure SetBitmap(Value:TBitmap);
Procedure SetButtonDown(Value:Boolean);
Procedure SetButtonDownGlyph(Value:TBitmap);
Procedure SetButtonInCaption(Value:Boolean);
Procedure SetButtonType(Value:TButtonType);
Procedure SetButtonUpGlyph(Value:TBitmap);
Procedure SetDropDownMenu(Value:TPopupMenu);
Procedure SetCaption(const Value:TCaption);
Procedure SetHeaderFont(Value:TFont);
Procedure SetHeaderHeight(Value:Integer);
Procedure SetHeaderVisible(Value:Boolean);
Procedure SetImageAlignment(Value:TImageAlignment);
Procedure SetImageIndex(Value:Integer);
Procedure SetImageList(Value:TImageList);
Procedure SetOnLeftButtonClick(Value:TNotifyEvent);
Procedure SetOnRightButtonClick(Value:TNotifyEvent);
Procedure SetPinCaption(const Value:TCaption);
Procedure SetSeparateArrow(Value:Boolean);
Procedure ShrinkRect(Var ARect:TRect);
Procedure SetTrackMouse(Value:Boolean);
Protected
Procedure AlignControls(AControl: TControl; var Rect: TRect);override;
Procedure CMColorChanged(Var Message:TMessage);message CM_COLORCHANGED;
Procedure CMVisibleChanged(Var Message:TMessage);message CM_VISIBLECHANGED;
Procedure CreateWnd;override;
Procedure WMEraseBkgnd(Var Message:TMessage);message WM_ERASEBKGND;
Procedure WMPaint(Var Message:TMessage);message WM_PAINT;
Procedure WMSetText(Var Message:TWMSetText);message WM_SETTEXT;
Procedure WMSize(Var Message:TMessage);message WM_SIZE;
Property ArrowButtonDown:Boolean read GetArrowButtonDown
write SetArrowButtonDown default False;
Property Bitmap:TBitmap read GetBitmap write SetBitmap;
Property ButtonDown:Boolean read GetButtonDown write SetButtonDown default False;
Property ButtonDownGlyph:TBitmap read GetButtonDownGlyph write SetButtonDownGlyph;
Property ButtonInCaption:Boolean read GetButtonInCaption write SetButtonInCaption default False;
Property ButtonType:TButtonType read GetButtonType write SetButtonType default btStandard;
Property ButtonUpGlyph:TBitmap read GetButtonUpGlyph write SetButtonUpGlyph;
Property Canvas:TCanvas read FCanvas;
Property Caption:TCaption read FCaption write SetCaption;
Property DropDownMenu:TPopupMenu read GetDropDownMenu write SetDropDownMenu;
Property HeaderFont:TFont read GetHeaderFont write SetHeaderFont;
Property HeaderHeight:Integer read FHeaderHeight write SetHeaderHeight default 0;
Property HeaderVisible:Boolean read FHeaderVisible write SetHeaderVisible default True;
Property ImageAlignment:TImageAlignment read GetImageAlignment write SetImageAlignment default iaRight;
Property ImageIndex:Integer read GetImageIndex write SetImageIndex;
Property ImageList:TImageList read GetImageList write SetImageList;
Property LeftButton:TDCHeaderButton read FLeftButton;
Property OnLeftButtonClick:TNotifyEvent read GetOnLeftButtonClick
write SetOnLeftButtonClick;
Property OnRightButtonClick:TNotifyEvent read GetOnRightButtonClick
write SetOnRightButtonClick;
Property PinCaption:TCaption read FPinCaption write SetPinCaption;
Property RightButton:TDCHotButton read FRightButton;
Property SeparateArrow:Boolean read GetSeparateArrow write SetSeparateArrow default False;
Property TrackMouse:Boolean read GetTrackMouse write SetTrackMouse default False;
Public
Constructor Create(AOwner:TComponent);override;
Destructor Destroy;override;
Published
Property Version:TDCVersion read FVersion write FVersion stored False;
End;
{ TDCHeaderPanel }
TDCHeaderPanel=Class(TDCCustomHeaderPanel)
Published
Property ArrowButtonDown;
Property Bitmap;
Property ButtonDown;
Property ButtonDownGlyph;
Property ButtonInCaption;
Property ButtonType;
Property ButtonUpGlyph;
Property Caption;
Property DropDownMenu;
Property HeaderFont;
Property HeaderHeight;
Property HeaderVisible;
Property ImageAlignment;
Property ImageIndex;
Property ImageList;
Property OnLeftButtonClick;
Property OnRightButtonClick;
Property PinCaption;
Property SeparateArrow;
Property TrackMouse;
property Align;
property BevelInner;
property BevelOuter;
Property BorderWidth;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property FullRepaint;
property Font;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDrag;
{$IFDEF D4}
property Anchors;
property BiDiMode;
property Constraints;
property DockSite;
property DragKind;
property OnCanResize;
property OnConstrainedResize;
property OnDockDrop;
property OnDockOver;
property OnEndDock;
property OnGetSiteInfo;
property OnStartDock;
property OnUnDock;
property ParentBiDiMode;
property UseDockManager default True;
{$ENDIF}
End;
TAlignmentType=(atHorizontal,atVertical);
TSplitterPanelAlign=TAlign;//alTop..alClient;
TSplitterPanelAligns=Set Of TSplitterPanelAlign;
TSmoothVisibleEvent=Procedure(Sender:TObject;NewVisibleValue:Boolean) Of Object;
TDCCustomBorderedPanel=Class(TCustomPanel)
Private
FBorderSides:TBorderSides;
Procedure SetBorderSides(Const Value:TBorderSides);
Protected
{$IFDEF D4}
Procedure AdjustClientRect(Var Rect:TRect);override;
{$ELSE}
Procedure AlignControls(AControl:TControl;Var ARect:TRect);override;
{$ENDIF}
Procedure CreateParams(var Params: TCreateParams);override;
Procedure Paint;override;
Procedure WMEraseBkgnd(Var Message:TMessage);message WM_ERASEBKGND;
Property BorderSides:TBorderSides read FBorderSides write SetBorderSides default [bdLeft, bdTop, bdRight, bdBottom];
Public
Constructor Create(AOwner:TComponent);override;
End;
TDCBorderedPanel=Class(TDCCustomBorderedPanel)
Published
Property BorderSides;
property Align;
property Alignment;
property BevelInner default bvLowered;
property BevelOuter default bvNone;
Property BevelWidth;
Property BorderWidth;
Property Caption;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property FullRepaint;
property Font;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDrag;
{$IFDEF D4}
property Anchors;
property AutoSize;
property BiDiMode;
property Constraints;
property DockSite;
property DragKind;
property OnCanResize;
property OnConstrainedResize;
property OnDockDrop;
property OnDockOver;
property OnEndDock;
property OnGetSiteInfo;
property OnStartDock;
property OnUnDock;
property ParentBiDiMode;
property UseDockManager default True;
{$ENDIF}
End;
TCustomDCSplitterPanel=Class(TDCCustomBorderedPanel)
Private
FAcceptControls:Boolean;
FActiveControl:TWinControl;
FAlignmentType:TAlignmentType;
{$IFNDEF D3}
FCanvas:TDCControlCanvas;
{$ENDIF}
FDragDelta:Integer;
FInsertFromDesigner:Boolean;
FInStopSizing:Boolean;
FIsMoving:Boolean;
FIsStreamedVisible:Boolean;
FLineDC:THandle;
FMainControl:TCustomDCSplitterPanel;
FMainWndProcInst:Pointer;
FMainWndHandle:THandle;
FMinSize:Integer;
FMoveX,
FMoveY:Integer;
FNeedReAlign:Boolean;
FNeedPropReAlign:Boolean;
FNewKoef:Double;
FOldKeyDown:TKeyEvent;
FOldMainWndProc:Pointer;
FOnSmoothVisible:TSmoothVisibleEvent;
FSaveControlSize:Integer;
FSecondaryControl:TCustomDCSplitterPanel;
FSmoothing:Boolean;
FSmoothStepCount:TPositiveInteger;
FSmoothStepDelay:Cardinal;
FSmoothVisible:Boolean;
FSplitterSize:Integer;
FSplitterVisible:Boolean;
FStreamedVisible:Boolean;
FUpdateControl:TCustomDCSplitterPanel;
FUpdateWidth:Boolean;
FUpdateSize:Integer;
FVersion:TDCVersion;
Procedure AllocateLineDC;
Procedure FocusKeyDown(Sender:TObject;Var Key:Word;Shift:TShiftState);
Function GetAlign:TSplitterPanelAlign;
Function GetAllPanel(Index:Integer):TCustomDCSplitterPanel;
Function GetAllPanelCount:Integer;
Function GetBevelWidth:Integer;
Procedure GetControls(ParentControl:TCustomDCSplitterPanel;Var MainControl,SecondaryControl:TCustomDCSplitterPanel);
Function GetPanel(Index:Integer):TCustomDCSplitterPanel;
Function GetPanelCount:Integer;
Function GetSplitterRect:TRect;
Function GetSplitterRectByXY(X,Y:Integer):TRect;
Procedure MainWndProc(Var Message:TMessage);
Function IsVerticalSplitter:Boolean;
Procedure MoveControls(FromControl,ToControl:TWinControl);
Procedure InternalPaintSplitter(X,Y:Integer;Moving:Boolean);
Procedure PaintSplitter(X,Y:Integer);
Procedure PaintMoveSplitter(X,Y:Integer);
Procedure ReadBinaryData(Stream:TStream);
Procedure ReleaseLineDC;
Procedure SetAlignmentType(Value:TAlignmentType);
Procedure SetSplitterSize(Value:Integer);
Procedure SetAlign(Value:TSplitterPanelAlign);
Procedure SetMinSize(Value:Integer);
Procedure SetNewKoef(AControl:TCustomDCSplitterPanel;AAlign:TAlign);
Procedure SetNeedPropReAlignFalse(AControl:TCustomDCSplitterPanel);
Procedure SetSplitterRectXY(X,Y:Integer);
Procedure StopSizing;
Procedure WriteBinaryData(Stream:TStream);
Property AllPanelCount:Integer read GetAllPanelCount;
{$IFNDEF D3}
Property Canvas:TDCControlCanvas read FCanvas;
{$ENDIF}
Property PanelCount:Integer read GetPanelCount;
Property Panels[Index:Integer]:TCustomDCSplitterPanel read GetPanel;
Protected
Procedure AlignControls(AControl:TControl;Var ARect:TRect);override;
Procedure CMDesignHitTest(Var Message:TCMDesignHitTest);message CM_DESIGNHITTEST;
Procedure CMVisibleChanged(Var Message:TMessage);message CM_VISIBLECHANGED;
Procedure CMCtl3DChanged(Var Message:TMessage); message CM_CTL3DCHANGED;
Procedure DefineProperties(Filer:TFiler);override;
{$IFNDEF D3}
Procedure DestroyWnd;override;
{$ENDIF D3}
Procedure DoSmoothVisible(NewVisibleValue:Boolean);virtual;
Procedure Loaded;override;
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(Component:TComponent;Operation:TOperation);override;
Function Split(AAlign:TAlign):TCustomDCSplitterPanel;
Procedure VisibleChanged(NewVisibleValue:Boolean);
Procedure VisibleChanging;override;
{$IFNDEF D3}
Procedure WndProc(Var Message:TMessage);override;
{$ENDIF D3}
Procedure WMCancelMode(Var Message:TMessage);message WM_CANCELMODE;
Procedure WMKillFocus(Var Message:TMessage);message WM_KillFocus;
Procedure WMPaint(Var Message:TMessage);message WM_PAINT;
Procedure WMSetCursor(Var Message:TMessage);message WM_SETCURSOR;
Property Align:TSplitterPanelAlign read GetAlign write SetAlign;
Property AlignmentType:TAlignmentType read FAlignmentType write SetAlignmentType;
Property MinSize:Integer read FMinSize write SetMinSize;
Property OnSmoothVisible:TSmoothVisibleEvent read FOnSmoothVisible write FOnSmoothVisible;
Property SmoothStepCount:TPositiveInteger read FSmoothStepCount write FSmoothStepCount;
Property SmoothStepDelay:Cardinal read FSmoothStepDelay write FSmoothStepDelay;
Property SmoothVisible:Boolean read FSmoothVisible write FSmoothVisible;
Property SplitterSize:Integer read FSplitterSize write SetSplitterSize;
Public
Constructor Create(AOwner:TComponent);override;
Destructor Destroy;override;
Procedure SplitHorz;
Procedure SplitVert;
Property AcceptControls:Boolean read FAcceptControls;
Property AllPanels[Index:Integer]:TCustomDCSplitterPanel read GetAllPanel;
Published
Property Version:TDCVersion read FVersion write FVersion stored False;
End;
TDCSplitterPanel=Class(TCustomDCSplitterPanel)
Published
Property AlignmentType;
Property MinSize;
Property OnSmoothVisible;
Property SmoothStepCount;
Property SmoothStepDelay;
Property SmoothVisible;
Property SplitterSize;
property Align;
property Alignment;
property BevelInner default bvLowered;
property BevelOuter default bvNone;
Property BevelWidth;
Property BorderSides;
Property BorderWidth;
Property Caption;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property FullRepaint;
property Font;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -