在面板上绘画(不松散最后的油漆) [英] drawing on the panel (not loosing last paint)

查看:62
本文介绍了在面板上绘画(不松散最后的油漆)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想在面板上绘画(我希望将点留在面板上我在表格上拖动的任何位置,以便可以绘制线,圆等).我不想丢失我的最后一个当我再次开始绘画时,绘画.解决方案是什么?在此先感谢.

Hello,I want to draw on a panel(I want the points to be left on the panel where ever I drag on the form. so that I can draw line,circle,etc.) I dont want to loose my last painting when I start to paint again.what''s the solution? Thanks in advance.

推荐答案

处理Panel.Paint事件-每当需要重绘面板时都会调用该事件,因此您在此处所做的任何绘画都会自动保存.它会向您提供EventArgs中的Graphics上下文,因此您无需负责获取或释放该上下文,并且可以使用Panel.Invalidate方法从代码中对其进行提示-因此,当您更改某些内容时,它会导致显示更改,请在面板上调用Invalidate,它将发生.
Handle the Panel.Paint event - it is called whenever the panel needs to be redrawn, so any painting you do there will automatically preserved. It hands you the Graphics context in the EventArgs, so you aren''t responsible for getting or Disposing the context, and it can be prompted from your code by using the Panel.Invalidate method - so when you change something and it should cause a display change, call Invalidate on the panel, and it will occur.


这篇关于在面板上绘画(不松散最后的油漆)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆