当我按一个键时,我们怎么能做按钮的flatappearance.mouseoverbackcolor属性? (Vb.net) [英] How can we do the effect of flatappearance.mouseoverbackcolor property of a button when I press a key? (Vb.net)

查看:59
本文介绍了当我按一个键时,我们怎么能做按钮的flatappearance.mouseoverbackcolor属性? (Vb.net)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试下面的代码但没有工作......



我尝试过的事情:



I try the code below but not working...

What I have tried:

Private Sub Button1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Button1.KeyPress
        If e.KeyChar = "2" Then

            Button1.FlatAppearance.MouseOverBackColor = Color.AliceBlue
        End If
End Sub

推荐答案

确定。当你按下键时,移动按钮的移动是什么?如果没有,你不会看到任何变化!



当你按下键时,你不清楚你想要发生什么。如果您想在按键时更改按钮的背景,无论鼠标位置如何,您都必须更改按钮的BackColor属性。
OK. So is the move hovering over the button when you press the key? If not, you're not going to see anything change!

It's not clear what you want to happen when you press the key. If you want the background of the button to change when you press the key, regardless of the mouse position, then you have to change the BackColor property of the button.


这篇关于当我按一个键时,我们怎么能做按钮的flatappearance.mouseoverbackcolor属性? (Vb.net)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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