Constructs a DlxTextStyle object.
Syntax: |
---|
new DlxTextStyle() new DlxTextStyle(name) new DlxTextStyle(handle) new DlxTextStyle(style) new DlxTextStyle(font, brush, outlinePen="none", backgBrush="none") |
Parameters
Parameter | Description |
---|---|
name | A string containing the name of the style. |
handle | A string containing the handle of the style. |
style | A DlxTextStyle object from which to copy the style. |
font | A DlxFontStyle object or a string containing the name or handle of the font style. |
brush | A DlxBrushStyle object or a string containing the name or handle of the brush. |
outlinePen | A DlxPenStyle object or a string containing the name or handle of the outline pen. |
backgBrush | A DlxBrushStyle object or a string containing the name or handle of the background brush. |
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_BYLAYER | Use the style of the text defined in the layer to which the object belongs. |
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 font = new DlxFontStyle("arial", 10, DlxApp.FONTSTYLE_BOLD, DlxApp.FONTUNIT_POINT);
var style = new DlxTextStyle(font, "blue");
doc.SetStyle(style);
layer.DrawText(new DlxPoint(50, 50), "Hello World.", 0, DlxApp.TEXTFLAGS_ALIGNDEFAUL);
}
}
}
|