mouseMove方法

caiyu0 2009-09-25 03:57:33
现在我有一个FORM表单,上面有若干个按钮,假定其中有3个按钮,分别是
Name为btn1,Text为按钮1
Name为btn2,Text为按钮2
Name为btn3,Text为按钮3
我想通过一个方法:
在鼠标移动到“按钮1”能够弹出消息框提示“btn1”
在鼠标移动到“按钮2”能够弹出消息框提示“btn2”
在鼠标移动到“按钮3”能够弹出消息框提示“btn3”
...全文
181 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
liujintaozyc 2009-09-25
  • 打赏
  • 举报
回复
在winform下不是直接就有事件吗
直接在那个下面写就行了
Error_Code 2009-09-25
  • 打赏
  • 举报
回复

btn1.mouseEnter+=mouseenter;
btn2.mouseEnter+=mouseenter;
btn3.mouseEnter+=mouseenter;

void mouseenter(object sender,mouseeeventarg e)
{
MessageBox.Show(((button)sender).Text);
}
serapn123 2009-09-25
  • 打赏
  • 举报
回复
DragOver、事件
获得鼠标坐标,控件坐标,鼠标坐标=控件坐标时弹出

你不做点击的话一般就只能通过坐标来判断了吧,
我才疏学浅就能想到这个了
caiyu0 2009-09-25
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 gwf25sz 的回复:]
C# code<input id="btn1" type="button" onmousemove="show(this)" text="按钮1"/><input id="btn2" type="button" onmousemove="show(this)" text="按钮2"/><input id="btn3" type="button" onmousemove="show(this)" text="按钮3"/>
JScript code<script>function show(o)
{
alert(o.id);
}</script>
[/Quote]

这个事WEB的,不是我想要的,两者貌似不能互用吧
caiyu0 2009-09-25
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 serapn123 的回复:]
mouseMove事件,
得到按钮的坐标,一个判断,当鼠标移动到相应坐标的时候做操作
[/Quote]


就没有鼠标指向按钮时返回相关信息的方法吗
gwf25sz 2009-09-25
  • 打赏
  • 举报
回复
<input id = "btn1" type = "button" onmousemove = "show(this)" text = "按钮1" />
<input id = "btn2" type = "button" onmousemove = "show(this)" text = "按钮2" />
<input id = "btn3" type = "button" onmousemove = "show(this)" text = "按钮3" />

<script>
function show(o)
{
alert(o.id);
}
</script>
serapn123 2009-09-25
  • 打赏
  • 举报
回复
mouseMove事件,
得到按钮的坐标,一个判断,当鼠标移动到相应坐标的时候做操作

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧