i need help
actualy my task is related to make image varificatin function ialso make it but in that function i returning the bitmap image so to show that image in the web page how can i show that. below i can send u the function that returnd the imge .
Public Shared Function RandomString(ByVal iLength As Integer) As String
Dim iZero, iNine, iA, iZ, iCount, iRandNum As Integer
Dim sRandomString As String ' we'll need random characters, so a Random object ' should probably be created...
Dim rRandom As New Random(System.DateTime.Now.Millisecond) ' convert characters into their integer equivalents (their ASCII values)
iZero = Asc("0")
iNine = Asc("9")
iA = Asc("A")
iZ = Asc("Z") ' initialize our return string for use in the following loop
sRandomString = ""
' now we loop as many times as is necessary to build the string ' length we want
While (iCount < iLength) ' we fetch a random number between our high and low values
iRandNum = rRandom.Next(iZero, iZ) ' here's the cool part: we inspect the value of the random number, ' and if it matches one of the legal values that we've decided upon, ' we convert the number to a character and add it to our string
If (((iRandNum >= iZero) And (iRandNum <= iNine) Or (iRandNum >= iA) And (iRandNum <= iZ))) Then
sRandomString = sRandomString + Chr(iRandNum)
iCount = iCount + 1
End If
End While ' finally, our random character string should be built, so we return it
RandomString = sRandomString
End Function
Public Function generateImage(ByVal sTextToImg As String)
'//
' //Here, i haven't used any try..catch
Dim pxImagePattern As PixelFormat = PixelFormat.Format32bppArgb
Dim bmpImage As Bitmap = New Bitmap(3, 3, pxImagePattern)
Dim fntImageFont As Font = New Font("Trebuchets", 14)
Dim gdImageGrp As Graphics = Graphics.FromImage(bmpImage)
Dim iWidth As Integer = gdImageGrp.MeasureString(sTextToImg, fntImageFont).Width
Dim iHeight As Integer = gdImageGrp.MeasureString(sTextToImg, fntImageFont).Height
bmpImage = New Bitmap(iWidth, iHeight, pxImagePattern)
gdImageGrp = Graphics.FromImage(bmpImage)
gdImageGrp.Clear(Color.White)
gdImageGrp.TextRenderingHint = TextRenderingHint.AntiAlias
gdImageGrp.DrawString(sTextToImg, fntImageFont, New SolidBrush(Color.Red), 0, 0)
gdImageGrp.Flush()
Return bmpImage
End Function
so can any one help me regarding this
if u have any other way to generate image varification then please sendme.
nishant
__________________
nishant
|