Dear All,
I have used infragistics 11.1 version on my win application;
On initializerow event, i have set image on cells; it throws outofmemory exception on some of the machine.
My code is,
Image anImage = Image.FromFile(iconsPath + "appointment.ico");
uieCell.Cell.Appearance.Image = anImage;
Please let me know the way to fix this issue and it is very urgrent; please do the needful.
Thanks,
Vasanth
Thanks Mike for your insight;
The functional requirements of our application is such that the images and combination of images which are pasted to cell.appearance.image is completely dynamic based on the incoming data. Also the entire wingrid resides in a DLL with the calling client being a VB application leveraging the win grid features.
We have improved the performance as well as avoided the out of memory issue by managing most of the dynamic image setting to the application load level methods.
Thanks a ton for your help !!!
Hi Vasanth,
If this code is in the InitializeRow event, then this is very inefficient. You are creating a new instance of the same image every time the event fires - and the event will fire multiple times for the same row. So you could be creating thousands of instances of the same image, which is a huge waste of memory.
You are also forcing the creation of a new Appearance object for each cell.
The efficient way to do this would be to create a set of Appearance objects - one for each appearance you need, and then apply those appearances to the cell(s) or columns.
Take a look at the WinGrid Performance Guide. The section entitled Re-Use Appearances discusses this in detail.