请问aspimage的详细使用方法

来源:百度知道 编辑:UC知道 时间:2024/05/21 09:10:01
最近遇到了aspimage想了解一下这个组件的具体使用。请高手指教

使用ASPImage组件仅需以下步骤:

建一个对象
设置若干属性
调用SaveImage方法
以下代码举例说明如何在vbscript中使用ASPImage组件,在这个例子中我们要建立一个渐进填充的字样为 "welcome to"的文字图片:

Set Image = Server.CreateObject("AspImage.Image")

rem Set various font parameters
Image.FontColor = vbBlack
Image.Italic = True
Image.Bold = True
Image.FontName = "Arial"
Image.FontSize = 12
Image.PadSize = 10

rem Calculate how big our text info is and set the image to this size
rem This has to be done since we want to fill the area with a gradient
strMessage = "Welcome to"
Image.MaxX = Image.TextWidth (strMessage)
Image.MaxY = Image.TextHeight (strMessage)

rem Create a one way gradient
Image.GradientOneWay vbRed, vbWhite, 0

rem Print our string to the image
Image.TextOut strMessage, Image.X, Image.Y, false

rem Set the filename and save