Paint application in visual C# [closed]
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this questionI have created a simple paint application in VC# 2008 with the help of a YouTube video. Its code is as here:
http://paste.pocoo.org/show/268704/
The problem with the code is that if I draw something in the picturebox, minimize the application, and thn maximize it, whatever I had drawn, disappears. The picturebox becomes clear. Why is it so? Plz help me.
You should be doing your painting during the Paint
event. This event completely redraws the image. So when you un-minimize the application, the image is redrawn and you don't do anything.
Your application needs to store information about what has been drawn so that it can be redrawn. This is an example of the Model-View-Controller model. The PictureBox
is the viewer, the stored information is the model and mouse event listeners will be part of the controller that can make alterations to the model.
精彩评论