图像的放大与缩小

Posted on   努力成长静待花开  阅读(409)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  PictureBox控件的Height和Width属性

  和PictureBox控件的SizeMode属性  //PictureBoxSizeMode枚举值

  

实现代码:

1
2
3
4
5
6
7
8
9
private void trackBar1_Scroll(object sender, EventArgs e)
{
    try
    {
        pictureBox1.Width = (int)(trackBar1.Value * pictureBox1.Image.Width * -0.2);
        pictureBox1.Height = (int)(trackBar1.Value * pictureBox1.Image.Height * -0.2);
    }
    catch {}
}

 

努力加载评论中...
点击右上角即可分享
微信分享提示