Einzelnen Beitrag anzeigen

Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#2

AW: Memo mit Inaktiv-Text

  Alt 19. Apr 2013, 17:04
Ich bin nicht sicher ob ich Dich richtig verstanden habe ... (Memo hat in diesem Beispiel den Tag 4711)
Inhalt wird nicht verändert ...

Delphi-Quellcode:
unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type

  TMemo = class(StdCtrls.TMemo)
  protected
    procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
  end;

  TForm3 = class(TForm)
    Memo1: TMemo;
    Edit1: TEdit;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}
{ TMemo }

procedure TMemo.WMPaint(var Message: TWMPaint);
var
  CC: TControlCanvas;
  r: TRect;
begin
  inherited;
  if not focused and (Tag = 4711) then
  begin
    CC := TControlCanvas.Create;
    try
      CC.Control := self;
      CC.Brush.Color := Color;
      r := ClientRect;
      InflateRect(r, 3, 3);
      CC.FillRect(r);
      CC.Font.Color := clSilver;
      CC.Font.Style := [fsItalic];
      CC.TextOut(5, 5, 'Nachrichtentext hier eingeben');
    finally
      CC.Free;
    end;
  end;
end;

end.
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat