Gets the width of the rectangle.

syntaxSyntax:
DlxRectangle.GetWidth()

Return Value

Returns the width of the rectangle.

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())
    {
      doc.SetStyle(new DlxPenStyle(0.5, "orange"));
      var obj = layer.DrawRectangle(new DlxRect(50,40,120,90), 0, 50, 0, 0, -50);
      
      var dlg = new DlxDialog(400, 160, "Size");
      if (dlg.IsValid())
      {
        dlg.AddStaticText(10, 33, 70, "Vertical: ");
        dlg.AddStaticText(10, 58, 70, "Horizontal: ");
        var ctrl_h = dlg.AddEditNumber(90, 30, 300, DlxApp.DIALOGEDITNUMBER_LENGTH, obj.GetHeight(), 0, 30);
        var ctrl_w = dlg.AddEditNumber(90, 55, 300, DlxApp.DIALOGEDITNUMBER_LENGTH, obj.GetWidth(), 0, 30);
        dlg.AddOkButton(280, 120, 50, 25);
        dlg.AddCancelButton(340, 120, 50, 25);
        if (dlg.DoModal())
        {
          obj.SetRectangle(obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMLEFT), ctrl_w.GetNumber(), ctrl_h.GetNumber());
        }
      }
    }
  }
}

See also