切换按钮在C#中的WinForms [英] ToggleButton in C# WinForms

查看:383
本文介绍了切换按钮在C#中的WinForms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能建立在C#中的WinForms切换按钮?我知道,你可以用一个CheckBox控件,并设置它的外观属性按钮,但它看起来不正确。我希望它出现凹陷,不平整,当pressed。有什么想法?

Is it possible to create a toggle button in C# WinForms? I know that you can use a CheckBox control and set it's Appearance property to "Button", but it doesn't look right. I want it to appear sunken, not flat, when pressed. Any thoughts?

推荐答案

我结束了重写的OnPaint和OnBackgroundPaint事件和手动绘制按钮酷似我需要它。它的工作pretty很好。

I ended up overriding the OnPaint and OnBackgroundPaint events and manually drawing the button exactly like I need it. It worked pretty well.

这篇关于切换按钮在C#中的WinForms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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