我们如何将paint事件添加到用户控件? [英] How can we add paint event to the user control?

查看:133
本文介绍了我们如何将paint事件添加到用户控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用户控件。如何添加绘图事件?

I have user control.How can I add paint event to it?

推荐答案

在VS的设计视图中打开你的控件。

突出显示整个控件 - 而不是它包含的组件 - 如果您不确定,可以在属性窗格中通过从窗格顶部的ComboBox中选择UserControl类名来执行此操作。

单击看起来像闪电的小按钮选择事件。

向下滚动到Paint事件,然后双击。这将添加默认处理程序代码,并为您准备好添加绘图代码的方法。
Open your control in design view in VS.
Highlight the whole control - rather than a component it contains - you can do this in the Properties pane by selecting the UserControl class name from the ComboBox at the top of the pane if you aren't sure.
Select "Events" by clicking the little button that looks like a lightning bolt.
Scroll down to the "Paint" event, and double click. This will add default handler code and put you in the method ready to add your painting code.


这篇关于我们如何将paint事件添加到用户控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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