K
karim
I have this function to zoom an image in my form, but I can't get it to work.
can anyone tell me how to get it to work or what's wrong with it. also i'm
getting this erorr msg: (local variable cannot have the same name as the
function containing it)
here is the code:
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
can anyone tell me how to get it to work or what's wrong with it. also i'm
getting this erorr msg: (local variable cannot have the same name as the
function containing it)
here is the code:
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