sdbmemo.pas

来自「AlphaControls是一个Delphi标准控件的集合」· PAS 代码 · 共 93 行

PAS
93
字号
unit sDBMemo;
{$I sDefs.inc}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, DBCtrls, sConst, sStyleEdits;

type
  TsDBMemo = class(TDBMemo)
  private
    procedure WMNCCalcSize (var Message: TWMNCCalcSize); message WM_NCCALCSIZE;
    procedure WMNCPaint (var Message: TMessage); message WM_NCPAINT;
    procedure WMPaint (var Message: TMessage); message WM_PAINT;
  protected
    FsStyle : TsStyle;
    procedure CreateWnd; override;
    procedure WndProc (var Message: TMessage); override;
  public
    LastControl : boolean;
    constructor Create(AOwner:TComponent); override;
    destructor Destroy; override;
    procedure Invalidate; override;
  published
    property sStyle:TsStyle read FsStyle write FsStyle;
  end;

implementation

{ TsDBMemo }

constructor TsDBMemo.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  BorderStyle := bsNone;
  DoubleBuffered := True;
  sStyle := TsStyle.Create(Self);
  sStyle.COC := COC_TsDBMemo;
  OnKeyDown := sStyle.onKeyDown;
  ParentColor := False;
end;

procedure TsDBMemo.CreateWnd;
begin
  inherited;
end;

destructor TsDBMemo.Destroy;
begin
  FreeAndNil(FsStyle);
  inherited;
end;

procedure TsDBMemo.Invalidate;
begin
  Color := sStyle.GetActiveColor;
  if (csDesigning in ComponentState) and Assigned(FsStyle) then begin
    FsStyle.BGChanged := True;
  end;
  sStyle.RedrawBorder;
  inherited;
end;

procedure TsDBMemo.WMNCCalcSize(var Message: TWMNCCalcSize);
begin
  inherited;
  InflateRect(Message.CalcSize_Params^.rgrc[0], -3, -3);
end;

procedure TsDBMemo.WMNCPaint(var Message: TMessage);
begin
  if (csDestroying in ComponentState) or (csLoading in ComponentState) then Exit;
  Color := sStyle.GetActiveColor;
  sStyle.RedrawBorder;
  inherited;
end;

procedure TsDBMemo.WMPaint(var Message: TMessage);
begin
  if (csDestroying in ComponentState) or (csLoading in ComponentState) then Exit;
  inherited;
  sStyle.RedrawBorder;
end;

procedure TsDBMemo.WndProc(var Message: TMessage);
begin
  if Assigned(FsStyle) then FsStyle.WndProc(Message);
  inherited;
end;

end.

⌨️ 快捷键说明

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