1.Flat button
用这个方法,前提是要把button的type设置为Flat
后面的颜色是窗体的颜色不是按钮的颜色。
接下来响应点击事件。
//鼠标弹起恢复原来图片
private void button1_MouseUp(object sender, MouseEventArgs e)
{
this.button1.Image = Image.FromFile(@"../../images/close_default.png");
}
//响应点击事件
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("I'm normal button");
}
private void pictureBox2_MouseUp(object sender, MouseEventArgs e)
{
this.pictureBox2.Image = Image.FromFile(@"../../images/close_default.png");
}
private void pictureBox2_Click(object sender, EventArgs e)
{
MessageBox.Show("I'm closed");
}
新闻热点
疑难解答