01-20-2012، 12:55 PM
Zoom an image in VB.NET
This is a snippet for zooming an imageکد:
Instructions: Need a reference to the System.Drawing.Drawing2D Namespace
کد پیاچپی:
Public Function ZoomImage(ByVal img As System.Drawing.Image, ByVal ZoomValue As Int32) As System.Drawing.Image
Dim width As Int32 = Convert.ToInt32(img.Width * ZoomValue) / 100
Dim height As Int32 = Convert.ToInt32(img.Height * ZoomValue) / 100
'Create a new image based on the zoom parameters we require
Dim zoomImage As New System.Drawing.Bitmap(img, width, height)
'Create a new graphics object based on the new image
Dim converted As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(zoomImage)
'Clean up the image
converted.InterpolationMode = InterpolationMode.HighQualityBicubic
'Return the zoomed image
Return zoomImage
End Function
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg