VS C# 2008鼠标移上时与按下时动态改变PicturBox的背景图片

//获得当前项目运行的路径
            path = System.IO.Directory.GetCurrentDirectory();

private void pictureBox1_MouseHover(object sender, EventArgs e)
        {
            this.pictureBox1.BackgroundImage=System.Drawing.Image.FromFile(path + @"\images\CloseButton_Hover.bmp");
        }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            this.pictureBox1.BackgroundImage = System.Drawing.Image.FromFile(path + @"\images\CloseButton_Down.bmp");
        }

        private void pictureBox1_MouseLeave(object sender, EventArgs e)
        {
            this.pictureBox1.BackgroundImage = System.Drawing.Image.FromFile(path + @"\images\CloseButton_Normal.bmp");
        }

你可能感兴趣的:(2008)