C# winform 按钮 响应鼠标经过变换图片,如何处理?急救

kenriy 2010-11-23 05:26:46
C# winform 按钮 响应鼠标经过变换图片,如何处理?急救
...全文
932 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
aqlick 2011-09-16
  • 打赏
  • 举报
回复
图片资源路径要放到\bin\Debug这个文件夹下才能用
button16.Image = Image.FromFile(Application.StartupPath +"\\Resources\\user(green).ico");

Application.StartupPath 这条语句是取你当前编译的\bin\Debug路径的。
kenriy 2010-12-03
  • 打赏
  • 举报
回复
label是不是没有点击事件的呢?
garfieldzf 2010-11-24
  • 打赏
  • 举报
回复


MouseEnter

MouseLeave
alian_1126 2010-11-24
  • 打赏
  • 举报
回复
-小蕾- 2010-11-24
  • 打赏
  • 举报
回复

private void lab_exit_MouseEnter(object sender, EventArgs e)
{
this.lab_exit.Image = Image.FromFile(path+"\\icon\\关闭-2.png");
}

private void lab_exit_MouseLeave(object sender, EventArgs e)
{
this.lab_exit.Image = Image.FromFile(path+"\\icon\\关闭-1.png");
}
kenriy 2010-11-24
  • 打赏
  • 举报
回复
把第一个事件改为mouseEnter,也试过了,还是没变化啊!救命啊
private void pictureBox1_MouseHover(object sender, EventArgs e)
{
try
{
this.pictureBox1.Image = Image.FromFile(Application.StartupPath+ @"\Resources\channels_on_13.gif");

}
catch (Exception) { }
}


private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
try
{
this.pictureBox1.Image = Image.FromFile(Application.StartupPath + @"\Resources\channels_on_10.gif");
}
catch (Exception) { }
}

private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
try
{
this.pictureBox1.Image = Image.FromFile(Application.StartupPath + @"\Resources\channels_on_10.gif");
}
catch (Exception) { }
}
kenriy 2010-11-24
  • 打赏
  • 举报
回复
或者说,toolStrip按钮美化,能否实现鼠标经过,更换图片吗?
zerodegrees 2010-11-24
  • 打赏
  • 举报
回复
mouseLeave
mouseEnter
nigerenz 2010-11-24
  • 打赏
  • 举报
回复
把第一个事件改为mouseEnter 试试
kenriy 2010-11-24
  • 打赏
  • 举报
回复
private void pictureBox1_MouseHover(object sender, EventArgs e)
{
try
{
this.pictureBox1.Image = Image.FromFile(Application.StartupPath+ @"\Resources\channels_on_13.gif");
}
catch (Exception) { }
}


private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
try
{
this.pictureBox1.Image = Image.FromFile(Application.StartupPath + @"\Resources\channels_on_10.gif");
}
catch (Exception) { }
}

怎么没反应的呢?晕
NewMan98 2010-11-23
  • 打赏
  • 举报
回复
MouseEnter会更好一点
jiangjun110120 2010-11-23
  • 打赏
  • 举报
回复
//鼠标移上去图片
private void btnHistory_MouseHover(object sender, EventArgs e)
{
try
{
lblHistory.Image = Image.FromFile(Application.StartupPath + @"\Image\mainImage\b102.png");
}
catch (Exception) { }
}
//鼠标移开图片
private void btnHistory_MouseLeave(object sender, EventArgs e)
{
try
{
lblHistory.Image = Image.FromFile(Application.StartupPath + @"\Image\mainImage\b10.png");
}
catch (Exception) { }
}
Peter200694013 2010-11-23
  • 打赏
  • 举报
回复
有对应的事件处理吧...比如 mouse_over之类的...

110,580

社区成员

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

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

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