![]() |
Auf RichEdit zeichnen
Halli hallo!
Ich habe seit 2 Tagen die Vostellung auf ein RichEdit zu zeichnen, hatte aber bis eben keine Zeit. Aber es hat auch nicht funktioniert!
Delphi-Quellcode:
Aber wenn's zum zeichnen in der WMPaint Methode kommt, bekomme ich ein Fehler, dass ich auf der Leinwand nicht zeichnen darf!
TREEx = class(TRichEdit)
private procedure WMPaint(var Msg: TWMPaint); message WM_Paint; end; { ... } procedure TREEx.WMPaint(var Msg: TWMPaint); var C: TCanvas; begin C := TCanvas.Create; try C.Handle := Msg.DC; C.Ellipse(10, 10, 100, 100); finally C.Free; end; end; Welche Wege gibt es noch, um auf ein RichEdit zu zeichnen? Danke schonmal! |
Re: Auf RichEdit zeichnen
Also hier hatte ich bei sowas mal mit:
Code:
Erfolg...
with TCanvas.Create do begin
Handle:= GetDC(self.Handle); MoveTo(100, 100); LineTo(150, 150); Free; end; |
Re: Auf RichEdit zeichnen
Hi,
du kannst aber auch eine neue RichEdit Komponente erstellen.
Delphi-Quellcode:
Anschließend kann die Eigenschaft Canvas der neue Kompo zum Zeichnen verwendet werden.
type
TCanvasRichEdit = class(TRichEdit) private FCanvas: TControlCanvas; function GetCanvas: TCanvas; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; property Canvas: TCanvas read GetCanvas; end; constructor TCanvasRichEdit.Create(AOwner: TComponent); begin inherited Create(AOwner); ScrollBars := ssBoth; FCanvas := TControlCanvas.Create; FCanvas.Control := Self; end; destructor TCanvasRichEdit.Destroy; begin FCanvas.Free; inherited Destroy; end; function TCanvasRichEdit.GetCanvas: TCanvas; begin Result := FCanvas; end; Nur mal so schnell - ungetestet. |
Re: Auf RichEdit zeichnen
Danke! Hat geklappt!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:35 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz