Gets the styles of the object.

syntaxSyntax:
DlxObject.GetStyle(style)

Parameters

Parameter Description
style An object of a class derived from the DlxStyle class.

Return Value

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

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, "orange");
      doc.SetStyle(pen);
      var obj = layer.DrawLine(new DlxPoint(30, 30), new DlxPoint(80, 80));

      var dlg = new DlxDialog(400, 160, "Pen style");
      if (dlg.IsValid())
      {
        obj.GetStyle(pen);
        dlg.AddStaticText(10, 33, 70, "Pen: ");
        var ctrl_ps = dlg.AddComboStyle(90, 30, 300, pen);
        dlg.AddOkButton(280, 120, 50, 25);
        dlg.AddCancelButton(340, 120, 50, 25);
        if (dlg.DoModal())
        {
          ctrl_ps.GetStyle(pen);
          obj.SetStyle(pen);
        }
      }
    }
  }
}

See also