Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2006, 12:54 AM
Authorized User
 
Join Date: Oct 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default image varification problem in asp.net1.1 plz help

hello
iam working on asp.net1.1 & make this function for generating the image conmtaining the alphanumeric characters but my problem is sir iam returning the bitmapo image to show on the webpage but iam unasble to show on the web page so please help me to suggest me the code to show the returning bitmap image beloww i can send u function



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



regds
nishant barsainyan



nishant

nishant
__________________
nishant





Similar Threads
Thread Thread Starter Forum Replies Last Post
image varification problem nirmalbarsainyan ASP.NET 1.0 and 1.1 Professional 0 October 25th, 2006 12:40 AM
Error in hosting ASP.NET1.1 Project aneesh_sunu@yahoo.co.in ASP.NET 1.0 and 1.1 Basics 1 October 13th, 2006 07:39 AM
Sendmail, Application - ASP.NET1.1-Urgent..Pls ! Abins ASP.NET 1.0 and 1.1 Basics 1 February 21st, 2006 08:06 AM
Beginning ASP.NET1.1 with VB.NET 2003 jhock7 Wrox Book Feedback 1 February 9th, 2004 09:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.