se_controls.pas

来自「小区水费管理系统源代码水费收费管理系统 水费收费管理系统」· PAS 代码 · 共 1,763 行 · 第 1/5 页

PAS
1,763
字号
{==============================================================================

  Common Controls
  Copyright (C) 2000-2002 by Evgeny Kryukov
  All rights reserved

  All contents of this file and all other files included in this archive
  are Copyright (C) 2002 Evgeny Kryukov. Use and/or distribution of
  them requires acceptance of the License Agreement.

  See License.txt for licence information

  $Id: se_controls.pas,v 1.12 2002/10/29 02:41:20 Evgeny Exp $

===============================================================================}

unit se_controls;

{$I se_define.inc}
{$T-,W-,X+,P+,O+}
{$WARNINGS OFF}
{$HINTS OFF}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Buttons,
  Menus, ImgList, Dialogs, StdCtrls, ActnList, ExtCtrls, ShellApi, Mask,
  Math, Clipbrd, Consts, Printers, ComCtrls, Imm, Grids,
  se_const, se_shared, se_winxp;

{!============================================================================!}

const
  sCommonVersion = '3.3.0';
  sCommonVersionPropText = 'KS Common Version ' + sCommonVersion;

type
  TSeCommonVersion = type string;

const
  Sig: PChar = '- ' + sCommonVersionPropText +
    {$IFDEF KS_DELPHI4} ' - D4 - '+ {$ENDIF}
    {$IFDEF KS_CBUILDER4} ' - CB4 - ' + {$ENDIF}
    {$IFDEF KS_DELPHI5} ' - D5 - '+ {$ENDIF}
    {$IFDEF KS_CBUILDER5} ' - CB5 - '+ {$ENDIF}
    {$IFDEF KS_DELPHI6} ' - D6 - '+ {$ENDIF}
    {$IFDEF KS_CBUILDER6} ' - CB6 - '+ {$ENDIF}
    {$IFDEF KS_DELPHI7} ' - D7 - '+ {$ENDIF}
    'Copyright (C) 1998-2002 by Evgeny Kryukov -';


const
  WordWraps: array [boolean] of Word = (0, DT_WORDBREAK);

type

{ HitTest enum }

  TSeHitTest = (khtClient, khtCaption, khtLeft, khtTop, khtRight,
    khtBottom, khtBorder, khtTopLeft, khtTopRight, khtBottomLeft,
    khtBottomRight, khtCloseButton, khtHelpButton, khtMinButton,
    khtMaxButton, khtRollButton, khtTrayButton, khtSysMenuButton,
    khtNonClient);

{ Form's BorderStyle }

  TSeBorderStyle = (kbsNone, kbsStandard, kbsToolWindow);

{ Form's BorderIcons }

  TSeBorderIcon = (kbiClose, kbiSystemMenu, kbiMinimize, kbiMaximize,
    kbiHelp, kbiRollup, kbiTray);
  TSeBorderIcons = set of TSeBorderIcon;

{ Form's states }

  TSeWindowState = (kwsNormal, kwsMaximized, kwsMinimized, kwsRollup, kwsTray);

{ Kind of form's buffering }

  TSeFormPerformance = (ksfpNoBuffer, ksfpSharedBuffer, ksfpPersistentBuffer, ksfpDoubleBuffer);

{ Expanded blending property }

  TSeBlending = class(TPersistent)
  private
    FEnabled: boolean;
    FValue: integer;
    FOnChange: TNotifyEvent;
    FWin2KBlending: boolean;
    procedure SetEnabled(const AValue: boolean);
    procedure SetValue(const AValue: integer);
    procedure SetWin2KBlending(const AValue: boolean);
  protected
    property Win2KBlending: boolean read FWin2KBlending write SetWin2KBlending;
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
    procedure Change;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  published
    property Enabled: boolean read FEnabled write SetEnabled default false;
    property Value: integer read FValue write SetValue default 150;
  end;

{ Expanded shadow property }

  TSeShadow = class(TPersistent)
  private
    FOnChange: TNotifyEvent;
    FEnabled: boolean;
    FSize: integer;
    procedure SetEnabled(const Value: boolean);
    procedure SetSize(const Value: integer);
  protected
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
    procedure Change;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  published
    property Enabled: boolean read FEnabled write SetEnabled default false;
    property Size: integer read FSize write SetSize default 4;
  end;

{ Expanded gravitation property }

  TSeGravitationKind = (kgkDock, kgkSite);

  TSeGravitation = class(TPersistent)
  private
    FEnabled: boolean;
    FSize: integer;
    FKind: TSeGravitationKind;
    procedure SetEnabled(const Value: boolean);
    procedure SetKind(const Value: TSeGravitationKind);
    procedure SetSize(const Value: integer);
  protected
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
    property Kind: TSeGravitationKind read FKind write SetKind default kgkDock;
  published
    property Enabled: boolean read FEnabled write SetEnabled default true;
    property Size: integer read FSize write SetSize default 20;
  end;

{ Animation property }

  TSeDirection = (kdNone, kdNoRotate, kdRotate90, kdRotate180, kdRotate270);

  TkeEffect = (keRandomSelect, keFade, keDiagonal, keDown, keIn, keOut, keRectIn, keRectOut,
    kePixel, kePixelLine, keDiamondIn, keDiamondOut, keSmoothDiagonal,
    keSmoothRectIn, keSmoothRectOut);

  TSeAnimation = class(TPersistent)
  private
    FEnabled: boolean;
    FTime: integer;
    FResolution: integer;
    FTileCount: integer;
    FEffect: TkeEffect;
    FDirection: TSeDirection;
    procedure SetResolution(const Value: integer);
    procedure SetTileCount(const Value: integer);
    procedure SetTime(const Value: integer);
  protected
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
  published
    property Direction: TSeDirection read FDirection write FDirection default kdNone;
    property Effect: TkeEffect read FEffect write FEffect default keFade;
    property Enabled: boolean read FEnabled write FEnabled default false;
    property Resolution: integer read FResolution write SetResolution default 1;
    property TileCount: integer read FTileCount write SetTileCount default 1;
    property Time: integer read FTime write SetTime default 400;
  end;

{ Expanded gragging property }

  TSeFormDragMode = (kfdmBorder, kfdmFullDrag);

  TSeDragging = class(TPersistent)
  private
    FSizeable: boolean;
    FMoveable: boolean;
    FDragMode: TSeFormDragMode;
  protected
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
  published
    property Moveable: boolean read FMoveable write FMoveable default true;
    property Sizeable: boolean read FSizeable write FSizeable default true;
    property DragMode: TSeFormDragMode read FDragMode write FDragMode default kfdmFullDrag;
  end;

{ Embeded form options }

  TSeFormOptions = class(TPersistent)
  private
    FOnChange: TNotifyEvent;
    FBlending: TSeBlending;
    FShadow: TSeShadow;
    FAnimation: TSeAnimation;
    procedure SetBlending(const Value: TSeBlending);
    procedure SetShadow(const Value: TSeShadow);
    procedure SetAnimation(const Value: TSeAnimation);
  protected
  public
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    procedure Change;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  published
    property Blending: TSeBlending read FBlending write SetBlending;
    property Shadow: TSeShadow read FShadow write SetShadow;
    property Animation: TSeAnimation read FAnimation write SetAnimation;
  end;

{ Embeded popupmenu options }

  TSePopupMenuOptions = class(TPersistent)
  private
    FOnChange: TNotifyEvent;
    FBlending: TSeBlending;
    FShadow: TSeShadow;
    FAnimation: TSeAnimation;
    procedure SetBlending(const Value: TSeBlending);
    procedure SetShadow(const Value: TSeShadow);
    procedure SetAnimation(const Value: TSeAnimation);
  protected
  public
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    procedure Change;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  published
    property Blending: TSeBlending read FBlending write SetBlending;
    property Shadow: TSeShadow read FShadow write SetShadow;
    property Animation: TSeAnimation read FAnimation write SetAnimation;
  end;

{ Extra WE_ERASEBKGND Params }

  TSeEraseBackgroundAction = (keaInvalidateRect, keaPaintBackground);

  PEraseBackgroundInfo = ^TEraseBackgroundInfo;
  TEraseBackgroundInfo = record
    Action: TSeEraseBackgroundAction;
    Rect: TRect;
    PaintChildren: boolean;
  end;

{ Extract TColor rec }

  PColorRec =^TColorRec;
  TColorRec = packed record
    case Cardinal of
      0: (Color: Cardinal);
      2: (HiWord, LoWord: Word);
      3: (R, G, B, A: Byte);
    end;

{ Alignment }

  TSeAlignment = (ktaLeftJustify, ktaRightJustify, ktaCenter);
  TSeLeftRight = ktaLeftJustify..ktaRightJustify;

{ Bevel Styles }

  TSeBevelCut = (kbvNone, kbvLowered, kbvRaised, kbvSpace, kbvBorder, kbvFlatBorder);
  TSeBevelSide = (kbsLeft, kbsTop, kbsRight, kbsBottom);
  TSeBevelSides = set of TSeBevelSide;
  TSeBevelKind = (kbkNone, kbkSingle, kbkTile, kbkSoft, kbkBorder, kbkFlat);


type

  { Color type }

  PKColor = ^TKColor;
  TKColor = type cardinal;

  PKColorRec =^TKColorRec;
  TKColorRec = packed record
    case Cardinal of
      0: (Color: Cardinal);
      2: (HiWord, LoWord: Word);
      3: (B, G, R, A: Byte);
    end;

  PKColorArray = ^TKColorArray;
  TKColorArray = array [0..0] of TKColor;

  PKColorRecArray = ^TKColorRecArray;
  TKColorRecArray = array [0..0] of TKColorRec;

  TTrArray = array of integer;

const

  ckBlack               : TKColor = $FF000000;
  ckGray                : TKColor = $FF7F7F7F;
  ckWhite               : TKColor = $FFFFFFFF;
  ckMaroon              : TKColor = $FF7F0000;
  ckGreen               : TKColor = $FF007F00;
  ckOlive               : TKColor = $FF7F7F00;
  ckNavy                : TKColor = $FF00007F;
  ckPurple              : TKColor = $FF7F007F;
  ckTeal                : TKColor = $FF007F7F;
  ckRed                 : TKColor = $FFFF0000;
  ckLime                : TKColor = $FF00FF00;
  ckYellow              : TKColor = $FFFFFF00;
  ckBlue                : TKColor = $FF0000FF;
  ckFuchsia             : TKColor = $FFFF00FF;
  ckAqua                : TKColor = $FF00FFFF;

  ckMenu                : TKColor = $FFEDEDEE;
  ckBorder              : TKColor = $FF003399;
  ckWindow              : TKColor = $FFEBEBEE;
  ckBtnFace             : TKColor = $FFD2D2D2;
  ckBtnShadow           : TKColor = $FFA8A8A8;
  ckHotHighlight        : TKColor = $FFF8C751;
  ckHighlight           : TKColor = $FF64A0FF;
  ckHintBack            : TKColor = $FFEBEBEE;

  ckTransparent         : TKColor = $007F007F;

type

  TSeBitmapLink = class;

{ TSeBitmap the main class }

  TSeBitmap = class(TPersistent)
  private
    FBitmapInfo: TBitmapInfo;
    FHandle: HBITMAP;
    FDC: HDC;
    FBits: PKColorArray;
    FTag: integer;
    FHeight: integer;
    FWidth: integer;
    FOnChanged: TNotifyEvent;
    FName: string;
    FBlend: boolean;
    FFont: TFont;
    FLinePos: TPoint;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?