Dear Sir,
I have an error 'Option Strict on disallows implicit conversions from double to integer` and `value type of double cannot be converted to point`
Please Guide me
Original code
Private Function ResizeImage(ByRef InputImage As Image, MaxWidth As Integer, MaxHeight As Integer) As Image
'ReSize the Image if needed to save space in the database
If MaxWidth < InputImage.Width Or MaxHeight < InputImage.Height Then
'ReSize Image
Dim Scale As Double = Math.Min(MaxWidth / InputImage.Width, MaxHeight / InputImage.Height)
Return New Bitmap(InputImage, New Size(Math.Round(InputImage.Width * Scale), Math.Round(InputImage.Height * Scale)))
Else
'Image size was OK
Return InputImage
End If
End Function
Code after Option Strict on
Private Function ResizeImage(ByRef InputImage As Image, MaxWidth As Integer, MaxHeight As Integer) As Image
'ReSize the Image if needed to save space in the database
If MaxWidth < InputImage.Width Or MaxHeight < InputImage.Height Then
'ReSize Image
Dim Scale As Double = Math.Min(MaxWidth / InputImage.Width, MaxHeight / InputImage.Height)
`error below line value type of double cannot be converted to point`
Return New Bitmap(InputImage, New Size(CType(Math.Round(InputImage.Width * Scale), Point), CInt(Math.Round(InputImage.Height * Scale))))
Else
'Image size was OK
Return InputImage
End If
End Function