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: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130:
| Unit Main;
Interface
Uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
Type TForm1 = Class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Procedure FormCreate(Sender: TObject); Procedure Button2Click(Sender: TObject); Procedure Button1Click(Sender: TObject);
Procedure onclosequery(Sender: TObject; Var CanClose: Boolean); Private Public End;
Var Form1: TForm1; XMin, XMax, YMin, YMax, XOffset, YOffset: Integer; XBegin, XEnde, YBegin, YEnde, XMitte, YMitte: Integer; XStep,YStep:Integer;
Implementation
{$R *.dfm}
Procedure TForm1.FormCreate(Sender: TObject); Begin Edit1.Text := '2'; Edit2.Text := '1'; Edit3.Text := '-10'; XOffset := 200; YOffset := 100; XMin := 0; XMax := 500; YMin := 0; YMax := 400; XBegin := XOffset + XMin; YBegin := YOffset + YMin; YMitte := YOffset + YMax Div 2; XEnde := XOffset + XMax; YEnde := YOffset + YMax; XMitte := XOffset + XMax Div 2; XStep := 25; YStep := 20; End;
Procedure TForm1.Button1Click(Sender: TObject); Var xbes, ybes: Integer; beschriftung: Integer; Begin With canvas Do Begin moveto(XBegin, YMitte); Lineto(XEnde, YMitte); moveto(XMitte, YBegin); Lineto(XMitte, YEnde); xbes := XBegin; beschriftung := -10; Repeat If Not (beschriftung = 0) Then textout(xbes - 2, YMitte + 2, inttostr(beschriftung)); xbes := xbes + XStep; beschriftung := beschriftung + 1; Until xbes > XEnde;
beschriftung := 10; ybes := YBegin; Repeat If Not (beschriftung = 0) Then textout(XMitte+3, ybes-6, inttostr(beschriftung)); ybes := ybes + YStep; beschriftung := beschriftung - 1; Until ybes > YEnde; End; End;
Procedure TForm1.Button2Click(Sender: TObject); Var x, y, a, b, c: Real; xkor: Real; Begin Try a := -strtofloat(Edit1.Text); b := strtofloat(Edit2.Text) * XStep; c := -strtofloat(Edit3.Text) * YStep; Except a := -1; b := 0; c := 0; End; x := -100; xkor := x; y := ((a * x * x)); x := x * XStep; y := y * XStep; canvas.moveto(round(x + XMitte + b), round(y + YMitte + c)); x := x / XStep; x := x + 0.1; Repeat y := ((a * x * x)); x := x * XStep ; y := y * YStep ; canvas.Lineto(round(x+ XMitte + b), round(y+YMitte + c)); x := x / XStep; x := x + 0.1; Until (x > -Xkor); End;
Procedure TForm1.onclosequery(Sender: TObject; Var CanClose: Boolean); Begin If Application.MessageBox('Möchten sie das Programm wirklich beenden?', 'Beenden', 4 + 32) = 6 Then CanClose := true Else CanClose := False; End;
End. |