Export image
Moderators: SDS, support, admin
Export image
hello
i have a second problem.
When i export a image a margin is applied around the bitmap.
example :
Is it possible do not have margin like this :
I'm using the code into your example :
Thanks for your help
Cyril
i have a second problem.
When i export a image a margin is applied around the bitmap.
example :

Is it possible do not have margin like this :

I'm using the code into your example :
Code: Select all
public void SaveAsImage()
{
if (_cadImage == null)
return;
if (saveImgDlg.ShowDialog() != DialogResult.OK)
return;
Zoom(1);
DRect tmpRect = new DRect(0.0, 0.0, VisibleAreaSize.Width * ImageScale, VisibleAreaSize.Height * ImageScale);
ImageFormat imgFrm = ImageFormat.Bmp;
if (saveImgDlg.FileName == null)
return;
string tmp = saveImgDlg.FileName;
if (tmp.ToUpper().IndexOf(ApplicationConstants.jpgextstr) != -1)
imgFrm = ImageFormat.Jpeg;
if (tmp.ToUpper().IndexOf(ApplicationConstants.bmpextstr) != -1)
imgFrm = ImageFormat.Bmp;
if (tmp.ToUpper().IndexOf(ApplicationConstants.tiffextstr) != -1)
imgFrm = ImageFormat.Tiff;
if (tmp.ToUpper().IndexOf(ApplicationConstants.gifextstr) != -1)
imgFrm = ImageFormat.Gif;
if (tmp.ToUpper().IndexOf(ApplicationConstants.emfextstr) != -1)
imgFrm = ImageFormat.Emf;
if (tmp.ToUpper().IndexOf(ApplicationConstants.pngextstr) != -1)
imgFrm = ImageFormat.Png;
if (tmp.ToUpper().IndexOf(ApplicationConstants.dxfextstr) != -1)
{
SaveAsDXF(saveImgDlg.FileName);
return;
}
if (!this._clipRectangle.Enabled)
{
rasterSizeForm.Image = this._cadImage;
rasterSizeForm.CurrentSize = tmpRect;
rasterSizeForm.SaveFileName = saveImgDlg.FileName;
if (rasterSizeForm.ShowDialog() == DialogResult.OK)
tmpRect = rasterSizeForm.SizeImage;
}
int tmpNumberOfPartsInCircle = this._cadImage.NumberOfPartsInCircle;
this._cadImage.NumberOfPartsInCircle = CADConst.SetNumberOfPartsInCurve(tmpRect);
if (this._clipRectangle.Enabled)
{
tmpRect = ImageDRect;
if ((imgFrm == ImageFormat.Emf) || (imgFrm == ImageFormat.Wmf))
_cadImage.ExportToMetafile(saveImgDlg.FileName, tmpRect, this._clipRectangle.ClientRectangle);
else
_cadImage.SaveToFile(saveImgDlg.FileName, imgFrm, tmpRect, this._clipRectangle.ClientRectangle, this.rasterSizeForm.ImagePixelFormat);
}
else
{
if ((imgFrm == ImageFormat.Emf) || (imgFrm == ImageFormat.Wmf))
_cadImage.ExportToMetafile(saveImgDlg.FileName, tmpRect);
else
_cadImage.SaveToFile(saveImgDlg.FileName, imgFrm, tmpRect, this.rasterSizeForm.ImagePixelFormat);
}
this._cadImage.NumberOfPartsInCircle = tmpNumberOfPartsInCircle;
}
Cyril
Re: Export image
Hello,
you can save image without the borders. To do this please modify your code sample by setting CADImage properties
BorderSize and IsWithoutMargins:
Alexander.
you can save image without the borders. To do this please modify your code sample by setting CADImage properties
BorderSize and IsWithoutMargins:
Code: Select all
...
if (!this._clipRectangle.Enabled)
{
rasterSizeForm.Image = this._cadImage;
rasterSizeForm.CurrentSize = tmpRect;
rasterSizeForm.SaveFileName = saveImgDlg.FileName;
if (rasterSizeForm.ShowDialog() == DialogResult.OK)
tmpRect = rasterSizeForm.SizeImage;
}
int tmpNumberOfPartsInCircle = this._cadImage.NumberOfPartsInCircle;
this._cadImage.NumberOfPartsInCircle = CADConst.SetNumberOfPartsInCurve(tmpRect);
this.cadImage.BorderSize = 0;
this.cadImage.IsWithoutMargins = true;
if (this._clipRectangle.Enabled)
{
tmpRect = ImageDRect;
...
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support