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
| procedure TFormSaveColorBox.BitBtnOKClick(Sender: TObject);
var
sFilename: string;
bmp: TBitmap;
begin
sFilename := SpinEditnm.Text + LabelNanometers.Caption +
SpinEditTHz.Text + LabelTHz.Caption + '.bmp';
spd.Options := spd.Options+[ofPathMustExist];
spd.FileName := sFilename;
if not spd.Execute then exit;
try
bmp := TBitmap.Create;
bmp.SetSize(SpinEditPixels.Value, SpinEditPixels.Value);
bmp.PixelFormat := pf24bit;
bmp.Canvas.Brush.Color := ShapeColorBox.Brush.Color; // /!\ .Brush /!\ sinon noir...
bmp.Canvas.FillRect(0,0,bmp.Width,bmp.Height);
//bmp.Canvas.FillRect(0,0,bmp.Width-1,bmp.Height-1); // -1 ça fait comme une ombre
bmp.SaveToFile(spd.Filename);
bmp.Free;
except
on E: Exception do begin
MessageDlg('Error','Error: '+E.Message,mtError,[mbOk],0);
end;
end;
Close;
end; |
Partager