TAILIEUCHUNG - Professional ASP.NET 1.0 Special Edition- P6
Professional Special Edition- P6:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | @ Import Namespace @ Import Namespace @ Import Namespace Dim height As integer 100 Dim width As integer 200 Dim r As New Random Dim x As integer 75 Dim x1 As integer 0 Dim a As integer 155 Dim x2 As integer 100 Dim bmp As new Bitmap width height Dim g As Graphics bmp 1 1 width-3 height-3 2 2 width-3 height-3 0 0 width height Test New Font Arial 10 New PointF 10 50 New SolidBrush a 255 128 255 x 20 100 50 New LinearGradientBrush New Point x2 0 New Point x2 75 50 30 128 0 0 128 255 255 255 240 x2 50 75 30 o There are four key lines that we need to look at- we will not be looking at all of the drawing functions since they are probably worthy of an entire book to themselves First we need to tell the browser requesting this page that we are sending back a set of bytes that represent an image- not a set of text in HTML format. @ Page Language VB ContentType image jpeg Next just to be safe we want to make sure that no header information has been sent back to the browser. To do this we need to clear the buffer. Remember that when the output to the browser is buffered as is the default then we can clear out that buffer at any time before it is sent back. The next part of the page is going to dynamically create a Bitmap object in memory and then draw to that object. Once we have completed drawing the bitmap we will want to send it to the browser. The Save method of the Bitmap object looks like this Public Sub Save _ ByVal stream As Stream _ .
đang nạp các trang xem trước