?? dxcore.pas
字號(hào):
{*******************************************************************}
{ }
{ dxCore (Design eXperience) }
{ }
{ Copyright (c) 2002 APRIORI business solutions AG }
{ (W)ritten by M. Hoffmann - ALL RIGHTS RESERVED. }
{ }
{ DEVELOPER NOTES: }
{ ========================================================== }
{ This file is part of a component suite called Design }
{ eXperience and may be used in freeware- or commercial }
{ applications. The package itself is distributed as }
{ freeware with full sourcecodes. }
{ }
{ Feel free to fix bugs or include new features if you are }
{ familiar with component programming. If so, please email }
{ me your modifications, so it will be possible for me to }
{ include nice improvements in further releases: }
{ }
{ Contact: mhoffmann@apriori.de }
{ }
{ History: }
{ =============================================================== }
{ 2002/05/02 }
{ * Replaced calling params with const attribute }
{ * Added some core methods (should be optimized in the future. }
{ * Minor Changes }
{ }
{ 2002/04/30 }
{ * Minor Changes }
{ }
{ 2002/04/29 }
{ * Fixed CMDialogChar }
{ (Thanks to Saeed Dudhia }
{ }
{ Release }
{ * Minor Bugfixes }
{ * Fixed OnClick method }
{ + Added Version property }
{ + Added support for earlier Delphi Versions }
{ (Thanks to Flavio Peinado) }
{ + Replaced OwnerDrawState with internal Structure }
{ + First Release }
{ }
{*******************************************************************}
unit dxCore;
interface
uses
Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs;
type
{ Common Structures }
TdxBoundLines = set of (blLeft, blTop, blRight, blBottom);
TdxColorSteps = 2..255;
TdxDrawState = set of (dsDefault, dsHotLight, dsFocused, dsSelected);
TdxGradientStyle = (gsLeft, gsTop, gsRight, gsBottom);
{ TdxUnleashedWinControl }
TdxUnleashedWinControl = class(TWinControl)
published
{ Published declarations }
property Color;
property Font;
end;
{ TdxCustomControl }
TdxCustomControl = class(TCustomControl)
private
{ Private desclarations }
FAbout: string;
FLocked: Boolean;
FModalResult: TModalResult;
FOnMouseLeave: TNotifyEvent;
FOnMouseEnter: TNotifyEvent;
procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMFocusChanged(var Message: TMessage); message CM_FOCUSCHANGED;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMParentColorChanged(var Message: TMessage); message CM_PARENTCOLORCHANGED;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure SetAbout(Value: string);
procedure SetVersion(Value: string);
protected
{ Protected desclarations }
function GetVersion: string; virtual;
procedure Click; 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 HookEnabledChanged; dynamic;
procedure HookFocusedChanged; dynamic;
procedure HookMouseDown; dynamic;
procedure HookMouseEnter; dynamic;
procedure HookMouseLeave; dynamic;
procedure HookMouseMove; dynamic;
procedure HookMouseUp; dynamic;
procedure HookParentColorChanged; dynamic;
procedure HookResized; dynamic;
procedure HookTextChanged; dynamic;
property ModalResult: TModalResult read FModalResult write FModalResult default 0;
public
{ Public desclarations }
DrawState: TdxDrawState;
IsSibling: Boolean;
constructor Create(AOwner: TComponent); override;
procedure LockUpdate;
procedure UnlockUpdate;
published
{ Published declarations }
property About: string read FAbout write SetAbout;
property Anchors;
property Align;
property BiDiMode;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentBiDiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Version: string read GetVersion write SetVersion;
property OnClick;
{$IFDEF VER140} { Borland Delphi 6.0 }
property OnContextPopup;
{$ENDIF}
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
{ TdxGradient }
TdxGradient = class(TPersistent)
private
{ Private-Deklarationen }
FColorSteps: TdxColorSteps;
FDithered: Boolean;
FEnabled: Boolean;
FEndColor: TColor;
FStartColor: TColor;
FGradientStyle: TdxGradientStyle;
protected
{ Protected declarations }
Parent: TControl;
procedure SetDithered(Value: Boolean); virtual;
procedure SetColorSteps(Value: TdxColorSteps); virtual;
procedure SetEnabled(Value: Boolean); virtual;
procedure SetEndColor(Value: TColor); virtual;
procedure SetGradientStyle(Value: TdxGradientStyle); virtual;
procedure SetStartColor(Value: TColor); virtual;
public
{ Public declarations }
Bitmap: TBitmap;
constructor Create(AOwner: TControl);
destructor Destroy; override;
procedure RecreateBands; virtual;
published
{ Published-Deklarationen }
property Dithered: Boolean read FDithered write SetDithered default True;
property ColorSteps: TdxColorSteps read FColorSteps write SetColorSteps default 16;
property Enabled: Boolean read FEnabled write SetEnabled default True;
property EndColor: TColor read FEndColor write SetEndColor default clSilver;
property StartColor: TColor read FStartColor write SetStartColor default clGray;
property Style: TdxGradientStyle read FGradientStyle write SetGradientStyle default gsLeft;
end;
// dxDrawLine
procedure dxDrawLine(const ACanvas: TCanvas; const x1, y1, x2, y2: Integer);
// dxDrawBoundLines
procedure dxDrawBoundLines(const ACanvas: TCanvas; const ABoundLines: TdxBoundLines;
const AColor: TColor; const R: TRect);
// dxCreateGradientRect
procedure dxCreateGradientRect(const Width, Height: Integer; const StartColor,
EndColor: TColor; const ColorSteps: TdxColorSteps; const Style: TdxGradientStyle;
const Dithered: Boolean; var Bitmap: TBitmap);
// dxRenderText
procedure dxRenderText(const Parent: TControl; const Canvas: TCanvas;
AText: string; const AFont: TFont; const Enabled, ShowAccelChar: Boolean;
var Rect: TRect; Flags: Integer);
// dxPlaceText
procedure dxPlaceText(const Parent: TControl; const Canvas: TCanvas;
const AText: string; const AFont: TFont; const Enabled, ShowAccelChar: Boolean;
const Alignment: TAlignment; const WordWrap: Boolean; var Rect: TRect);
// dxSetDrawFlags
procedure dxSetDrawFlags(const Alignment: TAlignment; const WordWrap: Boolean;
var Flags: Integer);
implementation
{ TdxCustomControl }
{-----------------------------------------------------------------------------
Procedure: TdxCustomControl.Create
Author: mh
Date: 22-Feb-2002
Arguments: AOwner: TComponent
Result: None
-----------------------------------------------------------------------------}
constructor TdxCustomControl.Create(AOwner: TComponent);
begin
inherited;
DoubleBuffered := True;
DrawState := [dsDefault];
IsSibling := False;
FAbout := 'Design eXperience.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -