如何使用自定义控件创建自定义按钮 [英] How to create a custom button using custom control

查看:113
本文介绍了如何使用自定义控件创建自定义按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用自定义控件创建自定义按钮而不继承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.ButtonBaseSystem.Windows.Forms.Control继承.

我了解您正在询问CustomControl.我最好的建议:算了!自定义控件并非旨在执行此类操作.

—SA
I assume you want to use System.Windows.Forms. WPF is a different story when it comes to styling things.

Right, you should not inherit from System.Windows.Forms.Button, you should inherit from System.Windows.Forms.ButtonBase or from System.Windows.Forms.Control.

I understand you''re asking about CustomControl. My best advice: forget it! Custom control is not designed to do such things.

—SA


这篇关于如何使用自定义控件创建自定义按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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