cxpc.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,633 行 · 第 1/5 页
PAS
1,633 行
function GetPageIndex: Integer;
function GetTabIndex: Integer;
procedure InternalColorChanged;
procedure SetHighlighted(const Value: Boolean);
procedure SetImageIndex(const Value: TImageIndex);
procedure SetPageControl(const Value: TcxPageControl);
procedure SetPageIndex(const Value: Integer);
procedure SetTabVisible(const Value: Boolean);
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMNCPaint(var Message: TWMNCPaint); message WM_NCPAINT;
procedure WMWindowPosChanged(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED;
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMParentColorChanged(var Message: TMessage); message CM_PARENTCOLORCHANGED;
procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure DoHide; dynamic;
procedure DoShow; dynamic;
procedure EnabledChanged; dynamic;
procedure PagePropertyChanged;
procedure SetParent(AParent: TWinControl); override;
procedure SetParentPageControl(AParentPageControl: TcxPageControl); virtual;
procedure ShowingChanged; dynamic;
procedure TextChanged; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property PageControl: TcxPageControl read FPageControl write SetPageControl;
property TabIndex: Integer read GetTabIndex;
property TabShowing: Boolean read FTabShowing;
published
property BorderWidth;
property Caption;
property Color;
property Constraints;
property DragMode;
property Enabled;
property Font;
property Height stored False;
property Highlighted: Boolean read FHighlighted write SetHighlighted default False;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
property Left stored False;
property PageIndex: Integer read GetPageIndex write SetPageIndex stored False;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabVisible: Boolean read FTabVisible write SetTabVisible default True;
property Top stored False;
property Visible stored False;
property Width stored False;
property OnClick;
{$IFDEF DELPHI5}
property OnContextPopup;
{$ENDIF}
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
property OnStartDrag;
end;
{ TcxTabControl }
TcxTabControl = class(TcxCustomTabControl)
public
property DisplayRect;
published
property Align;
property Anchors;
property BiDiMode;
property Color;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Focusable;
property Font;
property HideTabs;
property HotTrack;
property ImageBorder;
property Images;
property LookAndFeel;
property MaxRotatedTabWidth;
property MultiLine;
property MultiSelect;
property NavigatorPosition;
property Options;
property OwnerDraw;
property ParentBackground;
property ParentBiDiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property RaggedRight;
property Rotate;
property ScrollOpposite;
property ShowFrame;
property ShowHint;
property Style;
property TabHeight;
property TabIndex;
property TabOrder;
property TabPosition;
property Tabs;
property TabSlants;
property TabStop;
property TabWidth;
property Visible;
property OnCanClose;
property OnChange;
property OnChanging;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDockDrop;
property OnDockOver;
property OnDragDrop;
property OnDragOver;
property OnDrawTab;
property OnDrawTabEx;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetImageIndex;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
procedure CorrectRect(var Rect: TRect; RectCorrection: TcxPCRectCorrection);
function DistanceGetter(const Distance: TcxPCDistance; const LongitudinalDistance: Boolean): Integer;
function GetButtonCount(NavigatorButtons: TcxPCNavigatorButtons): Integer;
function GetTextRotationAngle(TabControl: TcxCustomTabControl): TcxRotationAngle;
procedure InitializeLineBoundsArray(TabControl: TcxCustomTabControl;
var LineIndexBoundsA: TcxPCLineIndexBoundsArray);
procedure InitializeVisibleTabRange(TabControl: TcxCustomTabControl;
var FirstIndex, LastIndex: Integer);
function InternalGetTextRotationAngle(TabControl: TcxCustomTabControl): TcxRotationAngle;
function InternalIsVerticalText(TabControl: TcxCustomTabControl): Boolean;
function IsBottomToTopAlignment(TabControl: TcxCustomTabControl): Boolean;
function IsOneOfButtons(AButton1, AButton2, AButton: TcxPCNavigatorButton): Boolean;
function IsRightToLeftAlignment(TabControl: TcxCustomTabControl): Boolean;
function IsVerticalText(TabControl: TcxCustomTabControl): Boolean;
function PointGetter(const APoint: TPoint; AIsY: Boolean): Longint;
procedure PointSetter(var APoint: TPoint; AIsY: Boolean; AValue: Longint);
procedure RectSetter(var ARect: TRect; AIsLeftTop, AIsY: Boolean;
AValue: Longint);
function RotateRect(const ARect: TRect; ATabPosition: TcxTabPosition): TRect;
function RotateRectBack(const ARect: TRect; ATabPosition: TcxTabPosition): TRect;
function TextSize(ATab: TcxTab; const AText: string; AFont: TFont = nil): TSize;
procedure ValidateRect(var R: TRect);
function GetPCStyleName(AStyleID: TcxPCStyleID): string;
function PageControlDependsControls: TList;
var
TabScrollingDelay: Integer = 150;
TabScrollingStartDelay: Integer = 300;
implementation
uses
Math, cxPCConsts, cxPCPainters, cxPCPaintersFactory, dxThemeConsts, dxThemeManager, dxUxTheme;
var
FBackgroundBitmap: TBitmap = nil;
FDependsControls: TList;
IsWin98Or2000: Boolean = False;
procedure CorrectRect(var Rect: TRect; RectCorrection: TcxPCRectCorrection);
begin
Inc(Rect.Top, RectCorrection.dTop);
Inc(Rect.Bottom, RectCorrection.dBottom);
Inc(Rect.Left, RectCorrection.dLeft);
Inc(Rect.Right, RectCorrection.dRight);
end;
function DistanceGetter(const Distance: TcxPCDistance; const LongitudinalDistance: Boolean): Integer;
begin
if LongitudinalDistance then
Result := Distance.dw
else
Result := Distance.dh;
end;
function GetButtonCount(NavigatorButtons: TcxPCNavigatorButtons): Integer;
var
NavigatorButton: TcxPCNavigatorButton;
begin
Result := 0;
for NavigatorButton := Low(TcxPCNavigatorButton) to High(TcxPCNavigatorButton) do
if NavigatorButton in NavigatorButtons then
Inc(Result);
end;
function GetControlRect(AControl: TControl): TRect;
begin
Result := Rect(0, 0, AControl.Width, AControl.Height);
end;
function GetTextRotationAngle(TabControl: TcxCustomTabControl): TcxRotationAngle;
begin
if IsVerticalText(TabControl) then
if pcoTopToBottomText in TabControl.Options then
Result := raMinus90
else
Result := raPlus90
else
Result := ra0;
end;
procedure InitializeLineBoundsArray(TabControl: TcxCustomTabControl; var LineIndexBoundsA: TcxPCLineIndexBoundsArray);
var
LineCount, I: Integer;
FirstIndex, LastIndex: Integer;
begin
SetLength(LineIndexBoundsA, TabControl.RowCount);
if TabControl.RowCount = 0 then
Exit;
for LineCount := 0 to TabControl.RowCount - 1 do
LineIndexBoundsA[LineCount].Left := -1;
InitializeVisibleTabRange(TabControl, FirstIndex, LastIndex);
for I := FirstIndex to LastIndex do
with LineIndexBoundsA[TabControl.FVisibleTabList[I].VisibleRow] do
if Left = -1 then
begin
Left := I;
Right := I;
end
else
begin
if I < Left then
Left := I;
if I > Right
then Right := I;
end;
end;
procedure InitializeVisibleTabRange(TabControl: TcxCustomTabControl; var FirstIndex,
LastIndex: Integer);
begin
if TabControl.MultiLine then
begin
FirstIndex := 0;
LastIndex := TabControl.FVisibleTabList.Count - 1;
end
else
begin
FirstIndex := TabControl.FFirstVisibleTab;
if TabControl.FFirstVisibleTab = -1 then
LastIndex := -2
else
LastIndex := TabControl.FLastVisibleTab;
end;
end;
function InternalGetTextRotationAngle(TabControl: TcxCustomTabControl): TcxRotationAngle;
begin
if TabControl.Painter.IsNativePainting then
Result := ra0
else
Result := GetTextRotationAngle(TabControl);
end;
function InternalIsVerticalText(TabControl: TcxCustomTabControl): Boolean;
begin
Result := not TabControl.Painter.IsNativePainting and
IsVerticalText(TabControl);
end;
function InternalGetCursorPos: TPoint;
begin
GetCursorPos(Result);
end;
function IsBottomToTopAlignment(TabControl: TcxCustomTabControl): Boolean;
begin
with TabControl do
begin
Result := (TabPosition in [tpLeft, tpRight]) and (not Rotate) and
not(pcoTopToBottomText in Options);
end;
end;
function IsOneOfButtons(AButton1, AButton2, AButton: TcxPCNavigatorButton): Boolean;
begin
Result := (AButton = AButton1) or (AButton = AButton2);
end;
function IsRightToLeftAlignment(TabControl: TcxCustomTabControl): Boolean;
begin
with TabControl do
begin
Result := (TabPosition in [tpTop, tpBottom]) and Rotate and
(pcoTopToBottomText in Options);
end;
end;
function IsVerticalText(TabControl: TcxCustomTabControl): Boolean;
begin
with TabControl do
begin
Result := (TabPosition in [tpLeft, tpRight]) and (not Rotate);
Result := Result or (TabPosition in [tpTop, tpBottom]) and Rotate;
end;
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?