您的位置:首页 > 其它

Button的放大与缩小

2020-01-15 09:26 183 查看

public Form1()
        {
            InitializeComponent();
            bool enlarged = false;
            button2.MouseEnter += delegate
            {
                if (!enlarged)
                {
                    Rectangle rect = button2.Bounds;
                    rect.Inflate(5, 5);//放大指定量
                    button2.Bounds = rect;
                    enlarged = true;
                }
            };
            button2.MouseLeave += delegate
            {
                if (enlarged)
                {
                    Rectangle rect = button2.Bounds;
                    rect.Inflate(-5, -5);
                    button2.Bounds = rect;
                    enlarged = false;
                }
            };

        }

转载于:https://www.cnblogs.com/chinaicm/archive/2008/07/16/1244002.html

  • 点赞
  • 收藏
  • 分享
  • 文章举报
dingqiao8604 发布了0 篇原创文章 · 获赞 0 · 访问量 76 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: