开发者

Paint application in visual C# [closed]

Closed. This question needs debugging details. It is not currently accepting answers. 开发者_StackOverflow社区

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 question

I 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜