Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Noch ein Problem mit Canvas (https://www.delphipraxis.net/37853-noch-ein-problem-mit-canvas.html)

Chuqa 11. Jan 2005 13:16


Noch ein Problem mit Canvas
 
Huhu,

ich habe da noch ein Problem mit der Paintbox und dem Befehl PlgBlt. Hier ersteinmal der Code.

Code:
procedure trans2d2(new_x,new_y:Single);
var sinus,cosinus:Single;
begin
  alpha:=(Form1.SpinEdit1.Value/180)*Pi;
  sinus:=sin(alpha);
  cosinus:=cos(alpha);
  x2:=x0+new_x*cosinus-new_y*sinus;
  y2:=y0-new_y*sinus-new_x*cosinus;
end;

procedure drehen2;
var i:integer;
begin
  punkt[0].X:=0;
  punkt[0].Y:=0;
  trans2d2(punkt[0].X,punkt[0].Y);
  punkt2[0].x:=round(x2);
  punkt2[0].Y:=round(y2);

  punkt[1].X:=Form1.PaintBox1.Width;
  punkt[1].Y:=0;
  trans2d2(punkt[1].X,punkt[1].Y);
  punkt2[1].X:=round(x2);
  punkt2[1].Y:=round(y2);

  punkt[2].X:=0;
  punkt[2].Y:=Form1.PaintBox1.Height;
  trans2d2(punkt[2].X,punkt[2].Y);
  punkt2[2].X:=round(x2);
  punkt2[2].Y:=round(y2);

  with Form1.PaintBox3 do
        SetViewportOrgEx(Canvas.Handle,Width div 2, Height div 2,nil);


  PlgBlt(Form1.PaintBox3.Canvas.Handle,punkt2[0],Form1.PaintBox1.Canvas.Handle,0,0,
        Form1.PaintBox1.Width,Form1.PaintBox1.Height,0,0,0);


end;
x2 und y2 sind global vereinbart. Bekomme keine Fehlermeldung sondern nur eine leere PaintBox3. In PaintBox1 ist aber etwas enthalten ;).

Bin für jede Hilfe dankbar.

Gruß Chuqa

Also folgendes: habe am Quelltext nichts geändert, aber ich hoffe mir kann jemand erklären wieso in der PaintBox etwas erscheint sobald ich die PaintBox auf einem Panel platziere. Wenn ich die PaintBox-Komponente dagegen einfach nur auf Formular packe, herrscht bei der Ausführung gähnende Leere. :gruebel: Ich hoff mir kann jemand helfen.

Gruß Chuqa

[edit=Luckie]Push-Posting entfernt. @Chuga: man kann auch Beiträge editieren hier im Forum. Mfg, Luckie[/edit]


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:46 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz