LoadFromStream error
Posted: 18 Aug 2014, 19:46
Hi,
I want to use CAD Import .net in my Windows Form, and often it runs alright.
But sometimes, I have an error message, when I want to open an image:
"at CADImport.CADImage. 0
at CADImport.CADPainter'1.ApplyScale(RectangleF Arect)
at CADImport.CADPainter'1. (CADImage, DRect)"
This is the code I use to open the image:
if (File.Exists(fileName))
{
FileOpen = new FileStream(fileName, FileMode.Open);
if (entCreator == null) entCreator = new EntitiesCreator(this.picture, Color.White);
if(FileOpen != null)
{
if (cadImage != null)
{
cadImage.Dispose();
cadImage = null;
}
ImageScale = 1.0f;
ImagePreviousScale = 1.0f;
pos = new PointF();
this.cadImage = CADImage.CreateImageByExtension(FileOpen.Name);
if (this.cadImage is CADRasterImage)
(this.cadImage as CADRasterImage).Control = this.picture;
}
if (this.cadImage != null)
{
CADConst.DefaultSHXParameters.SHXSearchPaths = frmSHX.SHXPaths;
CADConst.DefaultSHXParameters.UseSHXFonts = false;
cadImage.LoadFromStream(FileOpen);
}
CADImage.LastLoadedFilePath = Path.GetDirectoryName(FileOpen.Name);
SetCADImageOptions();
}
The fileName is always the same.The message appears in cadImage.LoadFromStream(FileOpen) method.
After this message, the image is alrigth open.
Could you help me, please?
Prisca.
I want to use CAD Import .net in my Windows Form, and often it runs alright.
But sometimes, I have an error message, when I want to open an image:
"at CADImport.CADImage. 0
at CADImport.CADPainter'1.ApplyScale(RectangleF Arect)
at CADImport.CADPainter'1. (CADImage, DRect)"
This is the code I use to open the image:
if (File.Exists(fileName))
{
FileOpen = new FileStream(fileName, FileMode.Open);
if (entCreator == null) entCreator = new EntitiesCreator(this.picture, Color.White);
if(FileOpen != null)
{
if (cadImage != null)
{
cadImage.Dispose();
cadImage = null;
}
ImageScale = 1.0f;
ImagePreviousScale = 1.0f;
pos = new PointF();
this.cadImage = CADImage.CreateImageByExtension(FileOpen.Name);
if (this.cadImage is CADRasterImage)
(this.cadImage as CADRasterImage).Control = this.picture;
}
if (this.cadImage != null)
{
CADConst.DefaultSHXParameters.SHXSearchPaths = frmSHX.SHXPaths;
CADConst.DefaultSHXParameters.UseSHXFonts = false;
cadImage.LoadFromStream(FileOpen);
}
CADImage.LastLoadedFilePath = Path.GetDirectoryName(FileOpen.Name);
SetCADImageOptions();
}
The fileName is always the same.The message appears in cadImage.LoadFromStream(FileOpen) method.
After this message, the image is alrigth open.
Could you help me, please?
Prisca.