Help Please

E

eamon

Can anyone convert this code into VB for me please my project isn't compling
the one below because im using VB.
 
K

kwkahler

'Here you go..
'Put these on top:

Imports System.Drawing.Image
Imports System.Drawing

'And here is the code:



Public Sub DisplaySize(ByVal bmp As Bitmap)
response.write (bmp.Width.ToString())
response.write (bmp.Height.ToString())
End Sub

'shrink the image proportionately so that neither height nor width is
'more than [NewSize] pixels

Public Function ShrinkImage(ByVal bmp As Bitmap, ByVal NewSize As
Integer) As Image
Dim NewWidth As Double
Dim NewHeight As Double
Dim ShrinkPercent As Double

Dim myCallback As GetThumbnailImageAbort
myCallback = New GetThumbnailImageAbort(AddressOf ThumbnailCallback)

If bmp.Width > bmp.Height Then
NewWidth = NewSize
ShrinkPercent = (NewWidth / bmp.Width) * 100
NewHeight = (ShrinkPercent / 100) * bmp.Height
Else
NewHeight = NewSize
ShrinkPercent = (NewHeight / bmp.Height) * 100
NewWidth = (ShrinkPercent / 100) * bmp.Width
End If
Dim myShrunkenImage As Image = bmp.GetThumbnailImage(NewWidth,
NewHeight, myCallback, IntPtr.Zero)
Return myShrunkenImage

End Function

Public Function ThumbnailCallback() As Boolean
Return False
End Function



'--
'William Kahler
'.NET Developer, MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top