Cyotek Forums

Source Code => Source Code => Topic started by: romeroa on March 07, 2017, 10:06:32 AM

Title: Error OutOfMemoryException
Post by: romeroa on March 07, 2017, 10:06:32 AM
Hi.
First of all tell that this control is magnificent.
But I'm having a problem when I include it as a reference in a VN.Net project (Visual Studio 2015).
I include as reference the library Cyotek.Windows.Forms.ImageBox.dll.
An error occurs while loading the third image (jpg) of a series: 'System.OutOfMemoryException' in System.Drawing.dll
To load the image I use the LoadFromFile method.
How can I solve this problem?
Thank you.
Title: Re: Error OutOfMemoryException
Post by: romeroa on March 07, 2017, 02:23:58 PM
I have already fixed the error.

Another question:
How zoomin/zoomout is limited in MouseWheel event?

Thank you.
Title: Re: Error OutOfMemoryException
Post by: Richard Moss on March 09, 2017, 04:53:09 PM
Hello,

Welcome to the forums! Glad you resolved your issue. As noted in this topic (https://forums.cyotek.com/imagebox/displaying-very-large-images/) ImageBox only displays pictures that you load. If .NET can't load your image, you can always try other libraries such as FreeImage (http://freeimage.sourceforge.net/) which have .NET wrappers and may be able to load your image.

Specially in regards to getting System.OutOfMemoryException when loading an image, this doesn't always mean an memory issue, it appears to be a generic error when an unknown problem is encountered.

In regards to your zoom question, there is a ZoomLevels property which lets you customise the zoom intervals used for zoom operations. You can see the default values here (https://github.com/cyotek/Cyotek.Windows.Forms.ImageBox/blob/master/Cyotek.Windows.Forms.ImageBox/ZoomLevelCollection.cs#L60). There is a hardcoded limit of 1 for the minimum zoom level and 3500 for the maximum however.

Hope this helps!

Regards;
Richard Moss
Title: Re: Error OutOfMemoryException
Post by: romeroa on March 10, 2017, 01:31:13 PM
Thank you Richard.

Solved!

Regards.