Click here to Skip to main content
15,886,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am drawing an image control on window form from code behind.
after that when i display an image in this control it give an error 'out of memory'.

how can i solve this problem ?
can anyone give me the suggestion.?


Thanks,
Posted
Comments
[no name] 2-Apr-12 3:40am    
Can you post code fragments to better understand it?
P.Salini 2-Apr-12 3:42am    
Post your code where you are getting error so that we can help you.
CPallini 2-Apr-12 3:43am    
Your code probably went into an infinite loop. We can just guess that without having a look at it.
swapnilKumbhar 2-Apr-12 3:43am    
May be your image buffer size is bigger than its capacity of storage.
but post code where actually you got error.
204.sharma 2-Apr-12 3:53am    
Here is my code.....

PictureBox pb_control = new PictureBox();
pb_control.Height = 500;
pb_control.Width = 500;
pb_control.BackColor = Color.Aqua;
pb_control.Invalidate();
panel1.Controls.Add(pb_control);
pb_control.Image = image.FromFile(@"C:\klr1.jpg");

1 solution

There are a couple of possibilities:

1) You have caused recursion somewhere in your code.
2) You are triggering a redraw from the draw routine.
3) You are creating graphics contexts (and / or other drawing objects) and not disposing of them.

Without your code though, we would be guessing.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900