如何使用自定义控件创建自定义按钮 [英] How to create a custom button using custom control
本文介绍了如何使用自定义控件创建自定义按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用自定义控件创建自定义按钮而不继承c#Windows应用程序中的Button控件?
预先感谢所有回复.
How to create a custom button using custom control without inheriting from Button control in c# windows application?
Thanks in advance to all replying.
推荐答案
我假设您要使用System.Windows.Forms
. WPF在样式化方面是一个不同的故事.
是的,您不应该从System.Windows.Forms.Button
继承,您应该从System.Windows.Forms.ButtonBase
或System.Windows.Forms.Control
继承.
我了解您正在询问CustomControl
.我最好的建议:算了!自定义控件并非旨在执行此类操作.
—SA
I assume you want to useSystem.Windows.Forms
. WPF is a different story when it comes to styling things.
Right, you should not inherit fromSystem.Windows.Forms.Button
, you should inherit fromSystem.Windows.Forms.ButtonBase
or fromSystem.Windows.Forms.Control
.
I understand you''re asking aboutCustomControl
. My best advice: forget it! Custom control is not designed to do such things.
—SA
这篇关于如何使用自定义控件创建自定义按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文