Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1809480
  • 博文数量: 354
  • 博客积分: 11021
  • 博客等级: 上将
  • 技术积分: 4048
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-24 10:04
文章存档

2020年(1)

2018年(1)

2016年(1)

2015年(2)

2014年(4)

2013年(4)

2012年(12)

2011年(14)

2010年(37)

2009年(34)

2008年(22)

2007年(68)

2006年(102)

2005年(29)

2004年(21)

分类: WINDOWS

2018-04-04 02:28:25

放缩很常见的吧,保存一下。vb.net的代码


以下代码,只要输入放缩系数x就可以实现放缩了(X>0就放大,X<0就缩小)。这是一个很大坑。图片缩小后,再放大就不清了。

点击(此处)折叠或打开

点击(此处)折叠或打开

  1. Function imgZoon(img As Image, x As Integer) As Image

  2.         If x > 0 Then

  3.             img = New System.Drawing.Bitmap(img, img.Width * x, img.Height * x)

  4.         Else

  5.             x = Math.Abs(x)

  6.             img = New System.Drawing.Bitmap(img, CInt(img.Width / x), CInt(img.Height / x))

  7.         End If

  8.         imgZoon = img

  9.     End Function

  10.     Private Sub ZoonIn_Click(sender As Object, e As EventArgs) Handles ZoonIn.Click

  11.         PictureBox.Image = imgZoon(barcodeReaderPictureBox.Image, 2)

  12.     End Sub

  13.     Private Sub ZoonOut_Click(sender As Object, e As EventArgs) Handles ZoonOut.Click

  14.         PictureBox.Image = imgZoon(barcodeReaderPictureBox.Image, -2)

  15.     End Sub





阅读(3687) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~