Registriert seit: 20. Feb 2007
90 Beiträge
Delphi XE6 Professional
|
Re: Grafik als screenshot
10. Mär 2007, 15:36
Es klappt immer noch nicht;
ich habe den quellcode minimal verändert, rufe paintbox nur direkt auf und erhalte beim Speichern nur einen schwarz weiße Kopie, obwohl die BRD zunächst farbig markiert wurde.
Liegt es an canvas-paintbox??
Hier noch einmal der quellcoe:
Delphi-Quellcode:
var
form1: Tform1;
var bitmap1:tbitmap;
implementation
{$R *.dfm}
procedure tform1.fromshow(sender:TObject);
begin
form1.Width:=7*screen.Width DIV 8;
form1.Height:=19*screen.Height div 20;
form1.Left:=(screen.Width-form1.Width) DIV 2;
form1.Top:=(screen.Height-form1.Height) div 2;
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('laender.bmp');
PaintBox1.Canvas.Draw(0,0,Bitmap1);
// Bitmap1.Free;
einfaerben(sender);
end;
procedure tform1.einfaerben(sender:TObject);
begin
with canvas do
// with paintbox1 do
begin
brush.color:= clbackground; //NRW
floodfill(paintbox1.Left+120,paintbox1.Top+260,clblack, fsborder);
brush.color:= clskyblue; //RHPf
floodfill(paintbox1.Left+80,paintbox1.Top+400,clblack, fsborder);
brush.color:= clblack; //Nieders
floodfill(paintbox1.Left+170,paintbox1.Top+150,clblack, fsborder);
brush.color:= clred; //Hessen
floodfill(paintbox1.Left+130,paintbox1.Top+390,clblack, fsborder);
brush.color:= clfuchsia; //BaWü
floodfill(paintbox1.Left+230,paintbox1.Top+500,clblack, fsborder);
brush.color:= clmaroon; //Bayern
floodfill(paintbox1.Left+260,paintbox1.Top+450,clblack, fsborder);
brush.color:=clgreen; //Saarland
floodfill(paintbox1.Left+60,paintbox1.Top+460,clblack, fsborder);
brush.color:= claqua; //Schl.Holstein
floodfill(paintbox1.Left+200,paintbox1.Top+90,clblack, fsborder);
brush.color:= clmoneygreen; //Bremen
floodfill(paintbox1.Left+154,paintbox1.Top+160,clblack, fsborder);
floodfill(paintbox1.Left+150,paintbox1.Top+124,clblack, fsborder);
brush.color:= clmedgray; //Mecklenburg Vorpomm
floodfill(paintbox1.Left+289,paintbox1.Top+150,clblack, fsborder);
brush.color:= clappworkspace; //Brandenburg
floodfill(paintbox1.Left+350,paintbox1.Top+200,clblack, fsborder);
brush.color:= clhotlight; //SachsenAnhalt
floodfill(paintbox1.Left+370,paintbox1.Top+370,clblack, fsborder);
brush.color:= clyellow; //Sachsen
floodfill(paintbox1.Left+270,paintbox1.Top+270,clblack, fsborder);
brush.color:= clpurple; //Thüringen
floodfill(paintbox1.Left+250,paintbox1.Top+320,clblack, fsborder);
brush.color:= clolive; //Berlin
floodfill(paintbox1.Left+385,paintbox1.Top+200,clblack, fsborder);
brush.color:= cllime; //Hamburg
floodfill(paintbox1.Left+220,paintbox1.Top+115,clblack, fsborder);
end;
end;
procedure Tform1.Button2Click(Sender: TObject);
begin
Bitmap1.Canvas.CopyRect(Rect(0, 0, Bitmap1.Width, Bitmap1.Height),
PaintBox1.Canvas, Rect(0, 0, Bitmap1.Width, Bitmap1.Height));
Bitmap1.SaveToFile('B.bmp');//wird jetzt überschrieben!
bitmap1.free;
end;
procedure Tform1.Button1Click(Sender: TObject);
begin
form1.close;
end;
end.
[edit=Jelly]Nächstes mal die Code-Tags bitte selbs einfügen Mfg, Jelly[/edit]
|