🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi
Article #334470

TMemo i Canvas

#334470
From: aaaa
Date: Sun, 25 Dec 2011 21:09
40 lines
2056 bytes
Hej,
Mam komponent TMemo, po którego Canvasie staram się rysować:

procedure TMyMemo.WMPaint(var Message: TWMPaint);
var DC: HDC;
    PS: TPaintStruct;
    Canvas: TCanvas;
    I: Integer;
begin
  DC := Message.DC;
  if DC = 0 then DC := BeginPaint(Handle, PS);
  Canvas := TCanvas.Create;
  Canvas.Handle := DC;
  with Canvas do
  begin
    //rameczka dookola
    Pen.Color := clBlue;
    Pen.Style := psDot;
    Brush.Style := bsClear;
    Rectangle(0, 0, ClientWidth-4, ClientHeight-4);
  end;
  Canvas.Free;
  if Message.DC = 0 then EndPaint(Handle, PS);
end;

Ramka rzeczywiscie się pojawia, ale starczy coś zaznaczyć w TMemo i znika, 
to co ja narysowałem a odpalane jest domyślne rysowanie zawartości TMemo. 
Przy pisaniu odpala się prawidłowo mój kod, bo zrobiłem override dla 
Change():

procedure TMyMemo.Change;
begin
  Invalidate;
  inherited Change;
end;

Nie wiem co jeszcze dopisać, żeby tylko moje rysowanie było uruchamiane.

-- 
A 
Technical Details
Message-ID: <4ef790f5$0$1457$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!wsisiz.edu.pl!plix.pl!newsfeed1.plix.pl!newspeer1.de.telia.net!newspeer4.de.telia.net!de.telia.net!nx02.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!wsisiz.edu.pl!plix.pl!newsfeed1.plix.pl!newspeer1.de.telia.net!newspeer4.de.telia.net!de.telia.net!nx02.iad01.newshosting.com!newshosting.com!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
From: "aaaa" <aaaa@aaaaaaaaaaaaaaaaaaa.com>
Newsgroups: pl.comp.lang.delphi
Subject: TMemo i Canvas
Date: Sun, 25 Dec 2011 22:09:22 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109
X-Antivirus: avast! (VPS 111225-0, 2011-12-25), Outbound message
X-Antivirus-Status: Clean
Lines: 41
Message-ID: <4ef790f5$0$1457$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 83.9.26.169
X-Trace: 1324847349 unt-rea-a-01.news.neostrada.pl 1457 83.9.26.169:4389
X-Complaints-To: abuse@news.neostrada.pl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit