![]() |
Re: Durchgehend zeichnen mit canvas
Oh da war ja wohl mein posting voreilig, sorry!!!
Danke für den code!!! |
Re: Durchgehend zeichnen mit canvas
:hi:
Delphi-Quellcode:
Ich habs kurz so gemacht.
{MD steht für MouseDown : Boolean, und OldP wäre TPoint}
procedure TMainForm.PaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin if not MD then Exit; // Bit.Canvas.MoveTo(OldP.X,OldP.Y); Bit.Canvas.LineTo(X,Y); // OldP := Point(X,Y); PaintBoxPaint(Self); end; procedure TMainForm.PaintBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin MD := True; //OldP := Point(X,Y); Bit.Canvas.MoveTo(X,Y) end; procedure TMainForm.PaintBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin MD := False; end; @Nicodius, erklär mir bitte kurz das "with Form1" ... mfg Tobias |
Re: Durchgehend zeichnen mit canvas
with form1 do begin
height := 10; end; ist das selbe wie form1.height := 10; |
Re: Durchgehend zeichnen mit canvas
:hi:
:wink: ja, das weiss ich :roll: ich find den Aufruf nur irgendwie überflüssig. mfg Tobias |
Re: Durchgehend zeichnen mit canvas
Bringt ja irgend wie nichts!
Ist eigentlich nur ein Nachteil! Das wirst du sehen, wenn du dann dein Formular umbenennst! |
Re: Durchgehend zeichnen mit canvas
Zitat:
|
Re: Durchgehend zeichnen mit canvas
das war nur weil ichs kopiert habe bei mir stehen ja noch andere sachen (paintbox :roll: )
aber der code funktioniert zu 100% |
Re: Durchgehend zeichnen mit canvas
Zitat:
Delphi-Quellcode:
einfach
procedure TForm1.StiftDraw(x, y: Integer);
begin with Form1 do begin if not FC then begin Paintbox1.Canvas.Pen.Color := Farbe; PaintBox1.Canvas.MoveTo(MOldPo.X, MOldPo.Y); PaintBox1.Canvas.LineTo(Xold, Yold); end else FC := False; ... end; end;
Delphi-Quellcode:
am besten wärs so:
procedure TForm1.StiftDraw(x, y: Integer);
begin if not FC then begin Paintbox1.Canvas.Pen.Color := Farbe; PaintBox1.Canvas.MoveTo(MOldPo.X, MOldPo.Y); PaintBox1.Canvas.LineTo(Xold, Yold); end else FC := False; ... end;
Delphi-Quellcode:
procedure TForm1.StiftDraw(x, y: Integer);
begin with Paintbox1.Canvas do begin if not FC then begin Pen.Color := Farbe; MoveTo(MOldPo.X, MOldPo.Y); LineTo(Xold, Yold); end else FC := False; ... end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:18 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