CreateBrush

The CreateBrush function creates a brush for shapes filling that has the specified style, color, and pattern.

CreateBrush sStyle, nColor, sHatch

Parameters

sStyle
String specifying the brush style. Must be one of the following styles
StringMeaning
"BS_SOLID" Solid brush
"BS_NULL" Null brush
"BS_HATCHED" Hatched brush
"BS_IMAGE" Custom brush

nColor
Specifies the color in which the brush is to be drawn.

sHatch
Specifies a hatch style.
If sStyle is BS_HATCHED, the sHatch parameter specifies the orientation of the lines used to create the hatch. It can be one of the following values:
StringMeaning
"HS_BDIAGONAL" A 45-degree upward, left-to-right hatch
"HS_CROSS" Horizontal and vertical cross-hatch
"HS_DIAGCROSS" 45-degree crosshatch
"HS_FDIAGONAL" A 45-degree downward, left-to-right hatch
"HS_HORIZONTAL" Horizontal hatch
"HS_VERTICAL" Vertical hatch
If sStyle is BS_SOLID, BS_NULL or BS_IMAGE, sHatch is ignored.

Remarks

Although nColor controls the foreground color of a hatch brush, the SetBkMode and SetBkColor functions control the background color.
The custom brush is the brush defined by any image from shotgraph imagespace: main or secondary. For more information about custom brushes see the SetBrushImage function.

Example
View result

<%@ Language=VBScript %>
<%
Response.ContentType="image/gif"
set obj=Server.CreateObject("shotgraph.image")

size=401
obj.CreateImage size,size,4
obj.SetColor 0,255,255,255
obj.SetColor 1,0,0,0
obj.SetColor 2,0,0,204
obj.SetColor 3,103,0,51
obj.SetBgColor 0
obj.FillRect 0,0,size-1,size-1

obj.CreateBrush "BS_SOLID",2,""
obj.FillRect size/6,size/6,size-1-size/6,size-1-size/6
obj.CreateBrush "BS_HATCHED",3,"HS_BDIAGONAL"
obj.FillRect size/2,size/2,size-2,size-2
obj.SetBkColor(1)
obj.CreateBrush "BS_HATCHED",0,"HS_FDIAGONAL"
obj.FillRect size/10,size/10,size/2-size/10,size/2-size/10

img=obj.GifImage(-1,1,"")
Response.BinaryWrite(img)
%>