1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type TForm1 = class(TForm) Bild: TImage; Button1: TButton; Neu: TButton; Edit1: TEdit; ScrollA: TScrollBar; Edit2: TEdit; ScrollB: TScrollBar; Edit3: TEdit; ScrollC: TScrollBar; Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure NeuClick(Sender: TObject); procedure Button1Click(Sender: TObject); private public end;
var Form1: TForm1; a,b,c,x,y: Double; x0,y0,xEins,yEins,xB,yB: integer;
implementation
{$R *.dfm}
procedure FangeNeuAn; begin a := -5+10*Form1.ScrollA.Position/100; b := -5+10*Form1.ScrollB.Position/100; c := -5+10*Form1.ScrollC.Position/100; with Form1.Bild do begin x0 := width DIV 2; y0 := height DIV 2; xEins := x0 + x0 DIV 3; yEins := y0 - y0 DIV 3; with canvas do begin pen.color := clBlack; pen.style := psSolid; MoveTo(0,y0); LineTo(2*x0,y0); MoveTo(x0,0); LineTo(x0,2*y0); MoveTo(xEins,y0+5); LineTo(xEins,y0-5); MoveTo(x0-4,yEins,); LineTo(x0+5,yEins); end end; xB := 0; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin if xB > 2*x0 then exit; x := (xb-x0)/(xEins-x0); y := a*x*x + b*x + c; yB:= Round(y*(yEins-y0)+y0); if xB = 0 then Bild.Canvas.MoveTo(xB,yB) else Bild.Canvas.LineTo(xB,yB); xB := xB + 1; end;
procedure TForm1.NeuClick(Sender: TObject); begin with Form1.Bild do begin canvas.Brush.Color := clWhite; canvas.Brush.Style := bsSolid; canvas.Rectangle(0,0,width,height) end; FangeNeuAn; end;
procedure TForm1.Button1Click(Sender: TObject); begin Close; end;
end. |