如何使用鼠标悬停和鼠标移动使用ImageButtons [英] How to work with ImageButtons with mouseover and mouseout

查看:110
本文介绍了如何使用鼠标悬停和鼠标移动使用ImageButtons的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

极客,



我浏览了很多网站,但我无法得到确切的参考资料。

我有一个显示图像的ImageButton。鼠标悬停时,图像应该是透明的,需要显示2个按钮更新和删除,如facebook。当我鼠标移出时,当前图像应该从trasparent返回到不透明。



这怎么可能?

Hi geeks,

I browsed many websites but I couldn't get exact references.
I got an ImageButton which displays an image. When I mouseover it, the image should be transparent and need to display 2 buttons "Update" and "Delete" like facebook. When I mouseout, the present image should get back from trasparent to opaque.

How this is possible??

推荐答案

你的按钮来自控制,就像您在任何Windows窗体上看到的一样。因此,您可以使用 MouseEnter (不是结束)和 MouseLeave 完成任务的事件。



输入,更改图像,创建和显示按钮,附加事件处理程序。

开离开,更改图片,销毁按钮。



如果您需要带有按钮的多个特殊图像按钮,请将其作为一个单独的类,并提及所提到的事件处理程序。
Your button is derived from Control like everything you see on any Windows Form. Therefore you can use the MouseEnter (not "over") and MouseLeave events to accomplish your task.

On Enter, change image, create and display buttons, attach event handlers.
On Leave, change image back, destroy buttons.

If you need several of those special image buttons with buttons on them, make it a separate class with the mentioned event handlers overridden.


你可以用CSS技术做到这一点。

演示



[演示]在悬停时在图像上显示按钮 [ ^ ]。
You can do this using CSS techniques.

Demo


[Demo] Show Buttons over Image on Hover[^].


这篇关于如何使用鼠标悬停和鼠标移动使用ImageButtons的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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