c# - How to draw with mouse? -


i want make simple mspaint. firstly, draw lines in mouse event.

private void pnl_draw_mousemove(object sender, mouseeventargs e) {     if(startpaint)     {         g = pnl_draw.creategraphics();         g.drawline(p, new point(initx ?? e.x, inity ?? e.y), new point(e.x, e.y));         initx = e.x;         inity = e.y;     } } 

and then, realized resolved if form minimized. however, how use onpaint event it? should store points in list when user click , move, , paint , clear them in onpaint event?

you need keep copy of last image bitmap object. user should update object in memory. can handle onpaint event of canvas display bitmap object background image.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -