unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
PaintBox1: TPaintBox;
Button1: TButton;
Button2: TButton;
procedure form1show(sender:TObject);
procedure PaintBox1Paint(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure einfaerben(sender:TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Bitmap1: TBitmap;
Form1: TForm1;
implementation
{$R *.dfm}
procedure tform1.form1show(sender:TObject);
begin
form1.Height:=19*screen.Height
div 20;
form1.Left:=(screen.Width-form1.Width)
DIV 2;
form1.Top:=(screen.Height-form1.Height)
div 2;
button1.top:=form1.Top+form1.Height-4*button1.height;
button2.Top:=button1.Top;
button2.left:=button1.Left+21*button1.width
div 20;
paintbox1.Height:=645;
paintbox1.width:=486;
paintbox1.Left:=(form1.Width-paintbox1.Width)
div 2;
paintbox1.Top:=(form1.Height-paintbox1.Height)
div 2;
paintbox1paint(sender);
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
Bitmap1 := TBitmap.Create;
Bitmap1.LoadFromFile('
DeutschUmriss.bmp');
PaintBox1.Canvas.Draw(0,0,Bitmap1);
Bitmap1.Free;
einfaerben(sender);
end;
procedure tform1.einfaerben(sender:TObject);
Var farbe:tcolor;
x,y:integer;
begin
with canvas
do
with paintbox1
do
begin
moveto(paintbox1.Left,paintbox1.Top);
lineto(paintbox1.Left+paintbox1.Width,paintbox1.Top);
lineto(paintbox1.Left+paintbox1.Width,paintbox1.Top+paintbox1.Height);
lineto(paintbox1.Left,paintbox1.Top+paintbox1.Height);
brush.color:= clred;
//Berlin
farbe:= pixels[X,Y];
floodfill(paintbox1.Left+385,paintbox1.Top+200,farbe, fsborder);
brush.color:= clyellow;
//Hamburg
farbe:= pixels[X,Y];
floodfill(paintbox1.Left+220,paintbox1.Top+115,farbe, fsborder);
brush.color:= clblack;
//Bremen
farbe:= pixels[X,Y];
floodfill(paintbox1.Left+154,paintbox1.Top+160,farbe, fsborder);
floodfill(paintbox1.Left+150,paintbox1.Top+124,farbe, fsborder);
brush.color:= clgreen;
//Nieders
farbe:= pixels[X,Y];
floodfill(paintbox1.Left+170,paintbox1.Top+150,farbe, fsborder);
brush.color:= clmaroon;
//NRW
farbe:= pixels[X,Y];
floodfill(paintbox1.Left+80,paintbox1.Top+260,farbe, fsborder);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
showmessage('
Aber wie???');
end;
end.