自定义VB按钮状态帮助 [英] Custom VB Button State Help

查看:162
本文介绍了自定义VB按钮状态帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我通过继承诸如Buttons之类的对象来制作自己的控件,从而在VB中玩耍.我是创建自定义控件的新手,想知道是否有人可以帮助我.

我创建了一个自定义按钮,并为其提供了背景图片.

现在,通常将鼠标悬停在按钮上时,窗口中的按钮会发生变化-例如图片或颜色的变化.

我们可以通过重写onMouseHover事件,然后将背景图像更改为另一个图像来获得类似效果,从而获得很好的悬浮效果,但是当我使用onMouseHover事件时,发现更改图片的速度比普通按钮慢得多.

这使我相信onMouseHover事件不适合此事件或不正确. IE.要根据按钮状态(悬停)更改按钮外观.

我应该重写或更改什么以重新创建按钮根据按钮状态改变外观的速度?

Hi Everyone,

I am playing around in VB by making my own controls by Inheriting objects such as Buttons. I am new to creating custom controls, and wonder if anybody can help me.

I have created a custom button, and given it a background image.

Now normally buttons in windows when you hover your mouse over a button the button changes - such as a change in picture or colour.

We can recreate a similar effect by overriding the onMouseHover event, and changing the background image to another image to get a hovered effect which is fine, however when using the onMouseHover event I have found it is much slower at changing the picture than a normal button.

This makes me to believe that the onMouseHover event is not suitable or the correct for this event. I.E. To make the button change appearance depending on the button state (hovered).

What do I override or change, to recreate the speed at which the button changes appearance depending on the state of the button?

推荐答案

鼠标悬停是一个缓慢的事件-它必须是因为它仅在鼠标在对象上静止不动一段时间后才触发.
如果要立即生效,则需要查看MouseEnter和MouseLeave事件!
Mouse Hover is a slow event - it has to be because it is only triggered after the mouse has been stationary over the object for a small period of time.
It you want an immediate effect, then you need to look at the MouseEnter and MouseLeave events instead!


这篇关于自定义VB按钮状态帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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