Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Blätter auf einem Stapel zeichnen (https://www.delphipraxis.net/9813-blaetter-auf-einem-stapel-zeichnen.html)

toms 5. Okt 2003 08:50


Blätter auf einem Stapel zeichnen
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hi!

Für ein Vokabelprogramm möchte ich "Blätter auf einem Stapel" (Karteikasten)
zeichnen. (Siehe Bild in der Anlage oder hier.

Ich brauche als eine Funktion, welche mir X Blätter auf einem
Stapel zeichnet.

Vielleicht hat ja jemand lust, mir eine solche Procedure zu schreiben.

Hier mal das Grundgerüst:

Delphi-Quellcode:
procedure ZeichneStapel(Image: TImage; AnzahlBlaetter: Integer);
begin
  // Zeichne Kasten unten
  // Code...

  // Zeichne Blätter
  for i := 1 to AnzahlBlaetter do
  begin
     // Code...
  end;
end;

imp 5. Okt 2003 10:36

Re: Blätter auf einem Stapel zeichnen
 
Ich würd dir vorschlagen 3 Vierecke zu zeichnen (eins für Vorderseite, oberstes Blatt und linke Seite) und dann n-mal einen Strich zur Andeutung eines Blattes.

toms 5. Okt 2003 19:55

Re: Blätter auf einem Stapel zeichnen
 
Liste der Anhänge anzeigen (Anzahl: 1)
Danke für deine Antwort!
Hab's nun mit Polygons gezeichnet.
Sieht für den Anfang nicht schlecht aus. Siehe Anlage.

Jetzt hab ich noch das Problem, daß der Hintergrund weiß gezeichnet wird.
Es bringt auch nichts, den Brush.Style auf bsClear zu setzen oder SetBkMode aufzurufen.

Delphi-Quellcode:
procedure TForm1.DrawPile(AImage : TImage; iNumCards : Integer);
const
  x1 = 10;
  y1 = 100;
var
  x2, dx, y2 : Integer;
  y2_temp, y1_temp : Integer;
  pts : array [0..3] of TPoint;
begin
  dx := 4;
  y2 := y1 - 10;
  x2 := x1 + 30;
  y2_temp := y2;
  y1_temp := y1;
  AImage.Picture := nil;
  AImage.Canvas.Brush.Color := clYellow;
  AImage.Canvas.Pen.Color := clBlack;
  AImage.Canvas.FillRect(AImage.BoundsRect);
  // SetBkMode(AImage.Canvas.Handle, TRANSPARENT);
  // AImage.Canvas.Brush.Style := bsClear;
  repeat
    pts[0] := Point(x1, y1_temp);
    pts[1] := Point(x1 - dx, y2_temp);
    pts[2] := Point(x2 - dx, y2_temp);
    pts[3] := Point(x2, y1_temp);
    AImage.Canvas.Polygon(pts);
    dec(y2_temp, 2);
    dec(y1_temp, 2);
  until (y2_temp = y2 - (2 * iNumCards)) or (iNumCards = 0);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:00 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