Brush based on a hatch style, a foreground color, and a background color. The foreground color defines the color of the hatch lines; the background color defines the color over which the hatch lines are drawn.

syntaxSyntax:
DlxBrushStyle.HatchBrush(hatchStyle, foreColor, backColor, lineWidth = 0.1, rotation = 0, scale = 1.0, offsetx = 0, offsety = 0)

Parameters

Parameter Description
hatchStyle A DlxHatchStyle object or a string containing the name or handle of the hatch style.
foreColor A DlxColor object or a string with the name of the color or its handle. Specifies the color to use for the hatch lines.
backColor A DlxColor object or a string with the name of the color or its handle. Specifies the color to use for the background.
lineWidth Width of the hatch lines.
rotation Specify the rotation angle, in degrees, of the pattern.
scale Specify the scale factor to apply to the chosen fill pattern.
offsetx Specify the horizontal coordinate of the origin of the pattern.
offsety Specify the vertical coordinate of the origin of the pattern.

Return Value

If the operation ends correctly, it returns true otherwise it returns false.

Remarks

The style handle is a 27-character alphanumeric string and appears in the box at the bottom of the Style Manager dialog box.

Example

  Copy codeCopy code
var prj = DlxApp.GetJob().GetProject("Example Sch");
if (!prj.IsValid())
  prj = DlxApp.GetJob().NewProject("Example Sch");
var doc = prj.GetDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
if (!doc.IsValid())
{
  doc = prj.NewDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
  doc.SetPageFormat("A4", false);
}
if (doc.IsValid() && doc.Activate())
{
  var page = doc.GetActivePage();
  if (page.IsValid())
  {
    var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
    if (layer.IsValid())
    {
      var pen = new DlxPenStyle(0.5, "green", "DASHED");
      var brush = new DlxBrushStyle("orange");
      doc.SetStyle(pen);
      doc.SetStyle(brush);
      var rect = new DlxRect(50,40,120,90);
      layer.DrawRectangle(rect, 0, 50, 0, 0, 50);
      brush.HatchBrush("ANGLE", "white", "darkcyan");
      doc.SetStyle(brush);
      rect.Offset(100, 0);
      layer.DrawRectangle(rect);
    }
  }
}

See also