小编jub*_*man的帖子

简单的按钮动画

我正在努力学习.NET编程.作为我学习的一部分,我试图对按钮产生一些影响.它工作......但不像我想象的那么顺利!有没有更好的方法来做到这一点?先感谢您!

我的需要:

有3个按钮.当您将鼠标悬停在其中一个上时,它会展开,当您从该按钮鼠标移出时,它会返回到其初始大小.

private void button1_MouseHover(object sender, EventArgs e)
    {
        button1.BackColor = Color.White;
        button1.Width = 130;
        button1.BringToFront();            
    }

    private void button1_MouseLeave(object sender, EventArgs e)
    {
        button1.BackColor = Color.Red;
        button1.Width = 75;         
    }

    private void button2_MouseHover(object sender, EventArgs e)
    {
        button2.BackColor = Color.Gray;
        button2.Width = 130;
        button2.BringToFront();            
    }

    private void Form1_MouseLeave(object sender, EventArgs e)
    {
        button2.BackColor = Color.Red;
        button2.Width = 75;

    }

    private void button3_MouseHover(object sender, EventArgs e)
    {
        button3.BackColor = Color.DimGray;
        button3.Width = 130;
        button3.BringToFront();
    }

    private void …
Run Code Online (Sandbox Code Playgroud)

.net c# animation button

2
推荐指数
1
解决办法
9861
查看次数

标签 统计

.net ×1

animation ×1

button ×1

c# ×1