Click here to Skip to main content
16,017,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
pictureBox1.Image = null;
           pictureBox1.Refresh();


I want to clear the image of picture box. I execute above code. But I couldn't clear the image of picturebox. Is there an error??
Posted
Updated 18-Aug-11 18:06pm

1 solution

Try this
C#
Graphics g = graphics.fromimage(pictureBox1.Image);
g.Clear(pictureBox1.Backcolor);

or you can just use Hide and Show
 
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