AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Delphi Schiebregler (Sierpinski Dreieck)

Ein Thema von Julezyyy · begonnen am 22. Okt 2008 · letzter Beitrag vom 22. Okt 2008
 
Julezyyy

Registriert seit: 22. Okt 2008
6 Beiträge
 
#6

Re: Delphi Schiebregler (Sierpinski Dreieck)

  Alt 22. Okt 2008, 13:03
Ok, habe ich. Und mit welchem Code 'füttere' ich nun diese TrackBar, damit ich mein gewünschtes Ergebnis erhalte.

Hier mein bisheriger Code:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    Bild: TImage;
    Abbrechen: TButton;
    Start: TButton;
    procedure AbbrechenClick(Sender: TObject);
    procedure StartClick(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.AbbrechenClick(Sender: TObject);
begin
  close;
end;

procedure TForm1.StartClick(Sender: TObject);
var a1,a2,a3,a4,a5,a6,b1,b2,b3,b4,b5,b6,xstart,ystart,n,zufall,x,y,anzahl : integer;
begin
  with Bild do

     // GRUND-DREICECK ZEICHNEN

    begin
     randomize;
     a1:=220; b1:=500; a2:=720; b2:=500; a3:=920; b3:=250;
     a4:=720; b4:=20; a5:=220; b5:=20; a6:=20; b6:=250; //Dreickes-Koordinaten
     canvas.MoveTo(a1,b1); // "Stift" aufsetzen
     canvas.LineTo(a2,b2); //Zeichen zu ...
     canvas.LineTo(a3,b3);
     canvas.LineTo(a4,b5);
     canvas.LineTo(a5,b5);
     canvas.LineTo(a6,b6);
     canvas.LineTo(a1,b1); // Dreieck gezeichnet (done)

     // STARTPUNKT SETZEN

     xstart:=170; ystart:=400;
     canvas.Pixels[xstart,ystart]:=clblack;
     n:=0;
      // "Regentropfen"
          anzahl:=1000000;
     repeat
      inc(n); zufall:=random(6);
      if zufall=0 then begin
                     x:=(xstart+a1) div 2; y:=(ystart+b1) div 2;
                     canvas.Pixels[x,y]:=clred;
                     xstart:=x ; ystart:= y ;
                  end;
      if zufall=1 then begin
                     x:=(xstart+a2) div 2; y:=(ystart+b2) div 2 ;
                     canvas.Pixels[x,y]:=clgreen;
                     xstart:=x ; ystart:= y ;
                  end;
      if zufall=2 then begin
                     x:=(xstart+a3) div 2 ; y:=(ystart+b3) div 2 ;
                     canvas.Pixels[x,y]:=clblue;
                     xstart:=x ; ystart:=y ;
                  end;
      if zufall=3 then begin
                     x:=(xstart+a4) div 2 ; y:=(ystart+b4) div 2 ;
                     canvas.Pixels[x,y]:=clyellow;
                     xstart:=x ; ystart:=y ;
                  end;
      if zufall=4 then begin
                     x:=(xstart+a5) div 2 ; y:=(ystart+b5) div 2 ;
                     canvas.Pixels[x,y]:=clpurple;
                     xstart:=x ; ystart:=y ;
                  end;
      if zufall=5 then begin
                     x:=(xstart+a6) div 2 ; y:=(ystart+b6) div 2 ;
                     canvas.Pixels[x,y]:=clsilver;
                     xstart:=x ; ystart:=y ;
                  end;
      until n=anzahl;
    end; // end of with
end;


end.
Best regards,
Julezyyy
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:32 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