unit Unit1;
{
Programmname Variante_Records.exe
Autor Christian S.
Datei Variante_Records.dpr
Dokumentation --
Datum 2004-05-10
Stand ok!
Version 1.1.0
Build 001
Modifis 2004-05-17 v1.1.0.1
1. Angefangen mit Variante Records.
Last Mod 2004-05-17
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TMain =
class(TForm)
Btn_Linie: TButton;
Btn_Rechteck: TButton;
Btn_Kreis: TButton;
Btn_Clear: TButton;
Splitter1: TSplitter;
L_X: TLabel;
Ed_X: TEdit;
L_Y: TLabel;
Ed_Y: TEdit;
L_X2: TLabel;
Ed_X2: TEdit;
L_Y2: TLabel;
Ed_Y2: TEdit;
Btn_Record: TButton;
procedure Btn_LinieClick(Sender: TObject);
procedure Btn_KreisClick(Sender: TObject);
procedure Btn_RechteckClick(Sender: TObject);
procedure Btn_ClearClick(Sender: TObject);
procedure Btn_RecordClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Main: TMain;
type
TShapeList = (Linie, Kreis, Rechteck);
TFigure =
record
case TShapeList
of
Linie : ( X1, Y1, X2, Y2: Integer);
// Linie
Kreis : ( A1, B1, A2, B2: Integer);
// Kreis
Rechteck : ( P1, Q1, P2, Q2: Integer);
// Rechteck
end;
implementation
{$R *.dfm}
{------------------------------------------------------------------------------}
procedure TMain.Btn_LinieClick(Sender: TObject);
var
X1, Y1, X2, Y2 : Integer;
begin
X1 := strtoint( Ed_X.Text);
Y1 := strtoint( Ed_Y.Text);
X2 := strtoint( Ed_X2.Text);
Y2 := strtoint( Ed_Y2.Text);
Canvas.MoveTo( X1,Y1);
Canvas.LineTo( X2,Y2);
end;
{------------------------------------------------------------------------------}
procedure TMain.Btn_KreisClick(Sender: TObject);
var
A1, B1, A2, B2 : Integer;
begin
A1 := strtoint( Ed_X.Text);
B1 := strtoint( Ed_Y.Text);
A2 := strtoint( Ed_X2.Text);
B2 := strtoint( Ed_Y2.Text);
Canvas.Brush.Style := bsClear;
Canvas.Ellipse( A1, B1, A2, B2);
end;
{------------------------------------------------------------------------------}
procedure TMain.Btn_RechteckClick(Sender: TObject);
var
P1, Q1, P2, Q2 : Integer;
begin
P1 := strtoint( Ed_X.Text);
Q1 := strtoint( Ed_Y.Text);
P2 := strtoint( Ed_X2.Text);
Q2 := strtoint( Ed_Y2.Text);
Canvas.Brush.Style := bsClear;
Canvas.Rectangle( P1, Q1, P2, Q2);
end;
{------------------------------------------------------------------------------}
procedure TMain.Btn_ClearClick(Sender: TObject);
begin
Refresh;
end;
{------------------------------------------------------------------------------}
procedure TMain.Btn_RecordClick(Sender: TObject);
begin
//
end;
end.