使用代码更改按钮的事件处理程序... [英] Changing event handler for button with code...

查看:72
本文介绍了使用代码更改按钮的事件处理程序...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.我正在编写的一些代码会在程序启动时创建一个按钮.如何使用代码更改click事件的事件处理程序?

我确定需要澄清这一点,但我真的想不出另一种方式来说明.如果您有任何疑问,请询问,我会尽力帮助您澄清.

Hello. Some code I''m writing creates a button at program startup. How can I change the event handler for the click event using code?

I''m sure I need to clarify this, but I can''t really think of another way to put it. If you have questions, please ask and I will try and help clarify.

Thanks in advance!

推荐答案

如果您尝试为刚刚在代码中创建的按钮连接Click事件,请查看AddHandler [
If your trying to wire up the Click event for a button you just created in code, look into AddHandler[^]. If you''re trying to remove the handler and replace it with something else, you''ll also need RemoveHandler.


您应该为此发布新的问题.连接MouseUp事件的方法必须与该事件的标题完全匹配.为什么要为MouseUp而不是Click布线?
You should have posted a new question for this. The method you wire the MouseUp event to must match exactly, the header for the event. Why are you wiring MouseUp instead of Click??


这篇关于使用代码更改按钮的事件处理程序...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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