Step 4 Viewing the Results in a Browser

Try it. Save the project and then press F5 to compile and run the project. The IDE opens up a new browser instance (see Figure 4.7).

Figure 4.7: The Dynamicimage.aspx Web Form before posting

Enter some text into the TextBox control and press Enter to submit the form. The server will respond with the text you entered in a GIF image sized appropriately to contain the text (see Figure 4.8).

Figure 4.8: The Dynamicimage.aspx Web Form after posting a-.

Figure 4.8: The Dynamicimage.aspx Web Form after posting

I don't know your level of experience with ASP, VB6, C++ or C#, or ASP.NET, but I can tell you—the first time I made this code run correctly, I was seriously impressed. Not only is the code that creates the bitmap only 13 (unwrapped) lines long, but there are no API calls, no handles, no special Declare statements, no memory management, no worries about memory leaks, and no DLLs to call or register. It just works. Now think of the hundreds of thousands of hours that people have spent doing exactly this kind of task for Web applications—drawing text in rectangles. I think this is a better way.

Was this article helpful?

0 0

Post a comment