unit mMiniPaint11;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls, Menus, ComCtrls, Tabs;
type
TForm1 =
class(TForm)
PnlWerkzeug: TPanel;
BitBtnFrei: TBitBtn;
BitBtnPunkt: TBitBtn;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Button1: TButton;
MainMenu1: TMainMenu;
Men1: TMenuItem;
Neu1: TMenuItem;
Schlieen1: TMenuItem;
BitBtn1: TBitBtn;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
DateTimePicker1: TDateTimePicker;
procedure BitBtnFreiClick(Sender: TObject);
procedure BitBtnPunktClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Edit1Change(Sender: TObject);
procedure Label4Click(Sender: TObject);
procedure Label5Click(Sender: TObject);
procedure Label6Click(Sender: TObject);
procedure Label7Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Neu1Click(Sender: TObject);
procedure Label9Click(Sender: TObject);
procedure Label10Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Status, Druecken: Boolean;
XPos , YPos , startx , starty , endex , endey : Integer;
gros : Integer;
implementation
{$R *.DFM}
procedure TForm1.BitBtnFreiClick(Sender: TObject);
begin
Label2.caption := '
Freihand';
Status:=False;
Druecken:=false;
end;
procedure TForm1.BitBtnPunktClick(Sender: TObject);
begin
Label2.caption := '
Punkt';
Druecken:=False;
Status:=True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Status := False;
Druecken := False;
Label2.Caption := '
Freihand';
Form1.Canvas.Create;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
If Status = False
Then
Begin
Druecken := True;
XPos := X;
YPos := Y;
End;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Status = False
Then
begin
Druecken := False
end
else
Begin
form1.Canvas.brush.color := form1.canvas.pen.color;
Form1.Canvas.Ellipse(X-2-gros, Y-2-gros, X +2+gros, Y +2+gros);
Form1.Canvas.Brush.Color := clWhite;
End;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if Druecken = True
Then
Begin
Form1.canvas.pen.width := gros;
Form1.Canvas.MoveTo(XPos, YPos);
XPos := X;
YPos := Y;
Form1.Canvas.LineTo(XPos, YPos);
End;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
gros := 1;
if edit1.Text = '
0'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 0;
end
else
if edit1.Text = '
1'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 1;
end
else
if edit1.Text = '
2'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 2;
end
else
if edit1.Text = '
3'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 3;
end
else
if edit1.Text = '
4'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 4;
end
else
if edit1.Text = '
5'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 5;
end
else
if edit1.Text = '
6'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 6;
end
else
if edit1.Text = '
7'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 7;
end
else
if edit1.Text = '
8'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 8;
end
else
if edit1.Text = '
9'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 9;
end
else
if edit1.Text = '
10'
then
begin
form1.font.color := clblack;
label8.hide;
gros := 10;
end
else
begin
form1.font.color := clred;
Label8.show;
Label8.caption := '
Fehler!';
end;
end;
procedure TForm1.Label4Click(Sender: TObject);
begin
Form1.Canvas.Pen.color := clblue;
Form1.Canvas.Brush.Color := clblue;
end;
procedure TForm1.Label5Click(Sender: TObject);
begin
Form1.Canvas.Pen.color := clred;
Form1.Canvas.Brush.Color := clred;
end;
procedure TForm1.Label6Click(Sender: TObject);
begin
Form1.Canvas.Pen.color := clgreen;
Form1.Canvas.Brush.Color := clgreen;
end;
procedure TForm1.Label7Click(Sender: TObject);
begin
Form1.Canvas.Pen.color := clblack;
Form1.Canvas.Brush.Color := clblack;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.canvas.rectangle (-1,-1,9999,9999);
end;
procedure TForm1.Neu1Click(Sender: TObject);
begin
Form1.Canvas.Brush.Color := clwhite;
Form1.canvas.rectangle (-100,-100,9999,9999);
Form1.Canvas.Brush.Color := clwhite;
end;
procedure TForm1.Label9Click(Sender: TObject);
begin
Form1.Canvas.Pen.color := clyellow;
Form1.Canvas.Brush.Color := clyellow;
end;
procedure TForm1.Label10Click(Sender: TObject);
begin
Form1.Canvas.Pen.color := clwhite;
Form1.Canvas.Brush.Color := clwhite;
end;
end.