如何创建自定义复选框控件 [英] How do I create a custom checkbox control

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

问题描述

您好。



我想为Windows窗体应用程序创建自定义复选框控件。

要做到这一点,我试图继承从一个按钮控件,并在按钮上放置一个透明的图片框。我希望控件能够像按钮控件一样对焦点和hower事件作出反应,但不仅如果鼠标在按钮上,而且如果鼠标在图片框上。控件应该像一个单元,而不是带有图片框的按钮。



感谢您的帮助。

解决方案

请看我对这个问题的评论。



请看我过去的答案:

在图片框中添加图片 [ ^ ],

在C#中绘制一个矩形 [ ^ ],

如何从旧图纸中清除面板 [ ^ ]。



当你面对它们时,其他问题都可以解决,但制定一个好的计划仍然会更好。



-SA

Hello.

I want to create a custom checkbox control for a windows forms application.
To do this I tried to inherit from a button control and placed a transparent picturebox on the button. I want the control to react on focus and hower events like the button control does, but not only if the mouse is on the button but also if the mouse is on the picturebox. The control shall behave like a unit, not like a button with a picture box.

Thanks for your help.

解决方案

Please see my comment to the question.

Please see my past answers:
Append a picture within picturebox[^],
draw a rectangle in C#[^],
How do I clear a panel from old drawing[^].

Other problems could be solved as you face them, but it's still better to make a good plan.

—SA


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

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