Sets the pen style.
Syntax: |
---|
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:
Handle | Name |
---|---|
DlxApp.PENCAP_ROUND | Round |
DlxApp.PENCAP_FLAT | Flat |
DlxApp.PENCAP_SQUARE | Square |
DlxApp.PENCAP_TRIANGULAR | Triangular |
DlxApp.PENCAP_OPENARROW | Open arrow |
DlxApp.PENCAP_EMPTYARROW | Empty arrow |
DlxApp.PENCAP_SOLIDARROW | Solid arrow |
DlxApp.PENCAP_EMPTYCONCAVEARROW | Empty concave arrow |
DlxApp.PENCAP_SOLIDCONCAVEARROW | Solid concave arrow |
DlxApp.PENCAP_EMPTYSHARPARROW | Empty sharp arrow |
DlxApp.PENCAP_SOLIDSHARPARROW | Solid sharp arrow |
DlxApp.PENCAP_DOUBLEOPENARROW | Double open arrow |
DlxApp.PENCAP_CLOSEDDOUBLEARROW | Closed double arrow |
DlxApp.PENCAP_DOUBLESOLIDARROW | Double solid arrow |
DlxApp.PENCAP_SLASH | Slash |
DlxApp.PENCAP_LEFTSLASH | Left slash |
DlxApp.PENCAP_RIGHTSLASH | Right slash |
DlxApp.PENCAP_CROSSSLASH | Cross slash |
DlxApp.PENCAP_EMPTYCIRCLE | Empty circle |
DlxApp.PENCAP_SOLIDCIRCLE | Solid circle |
DlxApp.PENCAP_EMPTYSQUARE | Empty square |
DlxApp.PENCAP_SOLIDSQUARE | Solid square |
DlxApp.PENCAP_EMPTYDIAMOND | Empty diamond |
DlxApp.PENCAP_SOLIDDIAMOND | Solid diamond |
DlxApp.PENCAP_OPENARROWINVERTED | Open arrow inverted |
DlxApp.PENCAP_EMPTYARROWINVERTED | Empty arrow inverted |
DlxApp.PENCAP_SOLIDARROWINVERTED | Solid arrow inverted |
Example
Copy 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));
}
}
}
|