简体   繁体   English

如何使按钮显示为按下?

[英]How to make a button appear as if it is pressed?

Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button look "pressed"? 使用VS2008,C#,。Net 2和Winforms如何使常规按钮看起来“按下”? Imagine this button is an on/off switch. 想象一下这个按钮是一个开/关开关。 ToolStripButton has the Checked property, but the regular Button does not. ToolStripButton具有Checked属性,但常规Button不具有。

可以用来获取此选项的一种方法是放置一个“CheckBox”对象并将其“Appearance”从“Normal”更改为“Button”,这将为您提供我认为您正在寻找的相同功能。

您可能也可以使用ControlPaint类。

I think you may need a ToggleButton . 我想你可能需要一个ToggleButton You can take a look at third party vendors of WinForms components such as Telerik, DevExpress, ComponentFactory, ViBlend which provide such control. 您可以查看WinForms组件的第三方供应商,例如提供此类控制的Telerik,DevExpress,ComponentFactory,ViBlend。 They all provide toggle buttons. 它们都提供了切换按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM