C# 使用PictureBox控件--点击切换图片

 

效果:

1.

2.

 

 

 

代码:

 1         private Boolean fals = true;
 2 
 3         /// <summary>
 4         /// 单击事件
 5         /// </summary>
 6         /// <param name="sender"></param>
 7         /// <param name="e"></param>
 8         private void pictureBox3_Click(object sender, EventArgs e)
 9         {
10             if (fals == true)
11             {
12                 this.pictureBox3.BackgroundImage = Image.FromFile(Application.StartupPath + "\\image\\" + "stop.ico");
13                 fals = false;
14             }
15             else
16             {
17                 this.pictureBox3.BackgroundImage = Image.FromFile(Application.StartupPath + "\\image\\" + "start.ico");
18                 fals = true;
19             }
20         } 

 

posted on 2015-04-26 02:02  ultrastrong  阅读(8237)  评论(1编辑  收藏  举报