代码1:
<%@ import Namespace =namespace="System" %>
<%@ import Namespace =namespace="System.Drawing" %>
<%@ import Namespace =namespace="System.Drawing.Imaging" %>
<Script runat="server">
Sub Page_Load()Sub Page_Load(s as object, e as eventargs)
dim imgOutput as New bitmap(150, 30, pixelformat.format24bpprgb)
dim g as graphics = graphics.fromimage(imgOutput)
g.clear(color.yellow)
g.drawString("How do you do.", New font("黑体",14,fontstyle.bold),systembrushes.windowtext, New pointF(2,2))
response.contenttype="image/gif"
imgOutput.save(response.outputstream, imageformat.gif)
g.dispose()
imgOutput.dispose()
End Sub
</Script>
代码2:
<%@ page language="vb" contenttype="image/jpeg" %>
<%@ import Namespace =namespace="system.drawing" %>
<%@ import Namespace =namespace="system.drawing.imaging" %>
<%@ import Namespace =namespace="system.drawing.drawing2d" %>
<%
response.clear
dim imgOutput as New bitmap(170, 30, pixelformat.format24bpprgb)
dim g as graphics = graphics.fromimage(imgOutput)
g.clear(color.Green)
g.smoothingMode = smoothingMode.antiAlias
g.drawString("How do you do.", New font("黑体",16,fontstyle.bold),new SolidBrush(Color.White),New pointF(2,4))
imgOutput.save(response.outputstream, imageformat.jpeg)
g.dispose()
imgOutput.dispose()
response.end
%>