Purpose
Specifies a fill style for graphic objects. You can use this clause in the MapBasic window in MapInfo Pro.
Syntax
Brush brush_expr
brush_expr is a Brush expression, such as MakeBrush( pattern, fgcolor, bgcolor ). (See MakeBrush( ) function for more information.) or a Brush variable.
Description
The Brush clause specifies a brush style―in other words, a set of color and pattern settings that dictate the appearance of a filled object, such as a circle or rectangle. Brush is a clause, not a complete MapBasic statement. Various object-related statements, such as Create Ellipse statement, allow you to specify a brush value. The keyword Brush may be followed by an expression which evaluates to a Brush value. This expression can be a Brush variable:
Brush br_var
or a call to a function which returns a Brush value:
Brush MakeBrush(64, CYAN, BLUE)
With some MapBasic statements (e.g., Set Map statement), the keyword Brush can be followed immediately by the three parameters that define a Brush style (pattern, foreground color, and background color) within parentheses:
Brush(64, CYAN, BLUE)
Some MapBasic statements take a Brush expression as a parameter (e.g., the name of a Brush variable), rather than a full Brush clause (the keyword Brush followed by the name of a Brush variable). The Alter Object statement is one example.
You can also directly assign a string-based style clause into a variable of type Brush. For example,
dim fnt as Font
fnt = "Font (""Arial"",0,9,0)"
'this assignment will work now, and string-based font clause will convert
Font variable.
The following table summarizes the three components (pattern, foreground color, background color) that define a Brush:
Component | Description |
---|---|
pattern | Integer value from 1 to 8 or from 12 to 186; see table below. |
foreground color | Integer RGB color value; see RGB( ) function. The definitions file, MAPBASIC.DEF, includes Define statements for BLACK, WHITE, RED, GREEN, BLUE, CYAN, MAGENTA, and YELLOW. |
background color | Integer RGB color value. |
To specify a transparent background, use pattern 3 or larger, and omit the background color from the Brush clause. For example, specify Brush(5, BLUE) to see thin blue stripes with no background fill color. Omitting the background parameter is like clearing the Background check box in MapInfo Pro's Region Style dialog box.
To specify a transparent background when calling the MakeBrush( ) function specify -1 as the background color.
The available patterns appear as follows. Pattern 2 produces a solid fill; pattern 1 produces no fill.
For a comprehensive list of fill patterns, see the MapInfo Pro Help―launch MapInfo Pro and open the Help System and search for MapInfo Pro Fill Pattern Table.
See Also:
CurrentBrush( ) function, MakeBrush( ) function, Pen clause, Font clause, Symbol clause