Error on export code
Posted: 14 Apr 2008, 19:42
hi, when im trying to export to bmp or jgp, in the code i get this error:
[DCC Error] Unit1.pas(563): E2010 Incompatible types: 'SGExport.TsgExportFormat' and 'Unit1.TsgExportFormat'
the weird thing is that i havent changed any code, and i've never get'd this error before...can u please help me here??
this is the rest of the code:
procedure TForm1.SmExportarClick(Sender: TObject);
var
E: TsgExport;
vFileName: string;
vWidth, vHeight: Integer;
vRatio: Double;
begin
if sgPaintBox.Empty or not SavePictureDialog.Execute then Exit;
vFileName := SavePictureDialog.FileName;
vWidth := sgPaintBox.Picture.Graphic.Width;
vHeight := sgPaintBox.Picture.Graphic.Height;
if vHeight <> 0 then
vRatio := vWidth / vHeight
else
vRatio := 1;
if vRatio <= 1 then
begin
vHeight := Screen.Height;
vWidth := Round(vHeight * vRatio);
end
else
begin
vWidth := Screen.Width;
vHeight := Round(vWidth / vRatio);
end;
case SavePictureDialog.FilterIndex of
1:
if AnsiLowerCase(ExtractFileExt(vFileName)) <> '.bmp' then
vFileName := vFileName + '.bmp';
2:
if (AnsiLowerCase(ExtractFileExt(vFileName)) <> '.jpg')
or (AnsiLowerCase(ExtractFileExt(vFileName)) <> '.jpeg') then
vFileName := vFileName + '.jpg';
end;
E := TsgExport.Create;
try
E.ExportTo(sgPaintBox.Picture.Graphic, vFileName,
TsgExportFormat(SavePictureDialog.FilterIndex-1), vWidth, vHeight);
finally
E.Free;
end;
end;
[DCC Error] Unit1.pas(563): E2010 Incompatible types: 'SGExport.TsgExportFormat' and 'Unit1.TsgExportFormat'
the weird thing is that i havent changed any code, and i've never get'd this error before...can u please help me here??
this is the rest of the code:
procedure TForm1.SmExportarClick(Sender: TObject);
var
E: TsgExport;
vFileName: string;
vWidth, vHeight: Integer;
vRatio: Double;
begin
if sgPaintBox.Empty or not SavePictureDialog.Execute then Exit;
vFileName := SavePictureDialog.FileName;
vWidth := sgPaintBox.Picture.Graphic.Width;
vHeight := sgPaintBox.Picture.Graphic.Height;
if vHeight <> 0 then
vRatio := vWidth / vHeight
else
vRatio := 1;
if vRatio <= 1 then
begin
vHeight := Screen.Height;
vWidth := Round(vHeight * vRatio);
end
else
begin
vWidth := Screen.Width;
vHeight := Round(vWidth / vRatio);
end;
case SavePictureDialog.FilterIndex of
1:
if AnsiLowerCase(ExtractFileExt(vFileName)) <> '.bmp' then
vFileName := vFileName + '.bmp';
2:
if (AnsiLowerCase(ExtractFileExt(vFileName)) <> '.jpg')
or (AnsiLowerCase(ExtractFileExt(vFileName)) <> '.jpeg') then
vFileName := vFileName + '.jpg';
end;
E := TsgExport.Create;
try
E.ExportTo(sgPaintBox.Picture.Graphic, vFileName,
TsgExportFormat(SavePictureDialog.FilterIndex-1), vWidth, vHeight);
finally
E.Free;
end;
end;