鼠标单击更改按钮图像背景。 [英] change button image background on mouse click.

查看:64
本文介绍了鼠标单击更改按钮图像背景。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好。我使用此代码更改按钮的背景,但它什么都不做。并且没有错误,也没有例外。我不知道为什么。

this.startpress.BackgroundImage =((System.Drawing.Image)(Properties.Resources.stop_press1)); 。谢谢你

解决方案

我认为你的资源stop_press1是空的。你可以试试这个:

  this  .startpress.BackgroundImage = Image.FromFile(  filename.jpg); 



希望这会有所帮助。


它没有给我任何结果。 :(

  private   void  startpress_Click(  object  sender,EventArgs e)
{
this .startpress.BackgroundImage = Image .FromFile( @ C:\ Users \ aziza \ Files \ Visual Studio 2010 \Projects \ PeerToPeerChat \ PeerToPeerChat \ Resources \start-press2.png);


}


good morning. i used this code to change the background for the button , but it do nothing . and give me no error ,no exception . i don''t know why .
"this.startpress.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.stop_press1));" . thank you

解决方案

I think your resourse stop_press1 is empty. You can try this:

this.startpress.BackgroundImage = Image.FromFile("filename.jpg");


Hope this helps.


it give me no result . :(

private void startpress_Click(object sender, EventArgs e)
       {
           this.startpress.BackgroundImage = Image.FromFile(@"C:\Users\aziza\Documents\Visual Studio 2010\Projects\PeerToPeerChat\PeerToPeerChat\Resources\start-press2.png");


       }


这篇关于鼠标单击更改按钮图像背景。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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