Sets the pen style.

syntaxSyntax:
DlxPenStyle.SetStyle(name)
DlxPenStyle.SetStyle(handle)
DlxPenStyle.SetStyle(style)
DlxPenStyle.SetStyle(width, color, dashStyle = "SOLID", startCap = "ROUND", endCap = "ROUND")
DlxPenStyle.SetStyle(width, brush, dashStyle = "SOLID", startCap = "ROUND", endCap = "ROUND")

Parameters

Parameter Description
name A string containing the name of the public style.
handle A string containing the handle of the public style.
style A DlxPenStyle object from which to copy the style.
width Specifies the width of this pen's stroke.
color A DlxColor object that specifies the color for this pen.
brush A DlxBrushStyle object that specifies the color for this pen.
dashStyle A DlxDashStyle object or a string containing the name or handle of the dash style.
startCap A string containing the name of the start cap or its handle.
endCap A string containing the name of the end cap or its handle.

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. Additionally, you can use the ones listed below:

DlxApp.STYLE_NULL The pen is invisible.
DlxApp.STYLE_BYLAYER Use the style of the pen defined in the layer to which the object belongs.

For the start and end line caps use one of the values listed below:

HandleName
DlxApp.PENCAP_ROUNDRound
DlxApp.PENCAP_FLATFlat
DlxApp.PENCAP_SQUARESquare
DlxApp.PENCAP_TRIANGULARTriangular
DlxApp.PENCAP_OPENARROWOpen arrow
DlxApp.PENCAP_EMPTYARROWEmpty arrow
DlxApp.PENCAP_SOLIDARROWSolid arrow
DlxApp.PENCAP_EMPTYCONCAVEARROWEmpty concave arrow
DlxApp.PENCAP_SOLIDCONCAVEARROWSolid concave arrow
DlxApp.PENCAP_EMPTYSHARPARROWEmpty sharp arrow
DlxApp.PENCAP_SOLIDSHARPARROWSolid sharp arrow
DlxApp.PENCAP_DOUBLEOPENARROWDouble open arrow
DlxApp.PENCAP_CLOSEDDOUBLEARROWClosed double arrow
DlxApp.PENCAP_DOUBLESOLIDARROWDouble solid arrow
DlxApp.PENCAP_SLASHSlash
DlxApp.PENCAP_LEFTSLASHLeft slash
DlxApp.PENCAP_RIGHTSLASHRight slash
DlxApp.PENCAP_CROSSSLASHCross slash
DlxApp.PENCAP_EMPTYCIRCLEEmpty circle
DlxApp.PENCAP_SOLIDCIRCLESolid circle
DlxApp.PENCAP_EMPTYSQUAREEmpty square
DlxApp.PENCAP_SOLIDSQUARESolid square
DlxApp.PENCAP_EMPTYDIAMONDEmpty diamond
DlxApp.PENCAP_SOLIDDIAMONDSolid diamond
DlxApp.PENCAP_OPENARROWINVERTEDOpen arrow inverted
DlxApp.PENCAP_EMPTYARROWINVERTEDEmpty arrow inverted
DlxApp.PENCAP_SOLIDARROWINVERTEDSolid arrow inverted

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, new DlxColor("orangered"), "DASHED");
      doc.SetStyle(pen);
      layer.DrawLine(new DlxPoint(30, 30), new DlxPoint(80, 80));
      pen.SetStyle(1, new DlxColor("DarkCyan"), "SOLID", "", "OPEN ARROW");
      doc.SetStyle(pen);
      layer.DrawLine(new DlxPoint(40, 30), new DlxPoint(90, 80));
    }
  }
}

See also