如何在vb.net中为事件编写代码 [英] How to Write Code for a event in vb.net

查看:136
本文介绍了如何在vb.net中为事件编写代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中有将近100个表单,现在我想在表单绘制事件中写点东西..

我已经在每个表单Load事件中调用了FormSettings类,现在我想在我的formSettings类中添加一个函数,该函数将修改每个表单的绘画功能...

喜欢...

我不能去更改所有100种表单的编码,而是将在FormSettings中为paint事件编写函数,该函数已经在表单加载事件中被调用...

我想做的就是使我的表单圆角...

I have nearly 100 forms in my projects and now i want to write some thing in my form paint event..

I have already called a FormSettings class in every forms Load event and now i want to add a function in my formSettings class which will modify the paint function of every form...

Like...

I cant go and change the coding for all 100 forms instead i will write function for paint event in FormSettings which has already been called in form load events...

What i want to do is to make my form round cornered...

Public Class FormSettings
Sub New(ByRef Form As Form)
Form.Paint += Deligate to call form paint event...........
End Sub
End Class

推荐答案

使用AddHandler
AddHandler Form.Paint, AddressOf Form_Paint



http://msdn.microsoft.com/en-us/library/7taxzxka (v = vs.80).aspx [



http://msdn.microsoft.com/en-us/library/7taxzxka(v=vs.80).aspx[^]


这篇关于如何在vb.net中为事件编写代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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