Hi Bud, Kann sein. In meinem jugendlichen Leichtsinn hatte ich mir das überlegt (TCustomMemo plus TGraphicControl):
Delphi-Quellcode:
TCustomMemo = class(TCustomEdit)
private
FLines: TStrings;
FAlignment: TAlignment;
FScrollBars: TScrollStyle;
FWordWrap: Boolean;
FWantReturns: Boolean;
FWantTabs: Boolean;
FCanvas: TCanvas; // ***
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
procedure WMNCDestroy(var Message: TWMNCDestroy); message WM_NCDESTROY;
procedure WMPaint(var Message: TWMPaint); message WM_PAINT; // ***
protected
procedure Paint; virtual; // ***
property Canvas: TCanvas read FCanvas; // ***
function GetCaretPos: TPoint; virtual;
procedure SetCaretPos(const Value: TPoint); virtual;
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWindowHandle(const Params: TCreateParams); override;
procedure KeyPress(var Key: Char); override;
procedure Loaded; override;
procedure SetAlignment(Value: TAlignment);
procedure SetLines(Value: TStrings);
procedure SetScrollBars(Value: TScrollStyle);
procedure SetWordWrap(Value: Boolean);
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssNone;
property WantReturns: Boolean read FWantReturns write FWantReturns default True;
property WantTabs: Boolean read FWantTabs write FWantTabs default False;
property WordWrap: Boolean read FWordWrap write SetWordWrap default True;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetControlsAlignment: TAlignment; override;
property CaretPos: TPoint read GetCaretPos write SetCaretPos;
property Lines: TStrings read FLines write SetLines;
end;