Sets the image frame.

syntaxSyntax:
DlxShoot.SetFrame(rect)
DlxShoot.SetFrame(x, y, width, height)
DlxShoot.SetFrame(point, width, height)

Parameters

Parameter Description
rect A DlxRect object that specifies the rectangle that bounds the drawing area for the image.
x Horizontal position of the bottom left corner of the frame.
y Vertical position of the bottom left corner of the frame.
width A positive value that defines the width of the frame.
height A positive value that defines the height of the frame.
point A DlxPoint object with coordinates specifying the lower left corner of the frame.

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 pos = layer.GetFrontObjectIterator();
      while (pos.IsValid())
      {
        var obj = layer.GetNextObject(pos);
        if (obj.GetType() == DlxApp.OBJTYPE_SHOOT)
        {
          var dlg = new DlxDialog(400, 160, "Image 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.SetFrame(obj.GetCornerPoint(DlxApp.CORNERINDEX_BOTTOMLEFT), ctrl_w.GetNumber(), ctrl_h.GetNumber());
            }
          }
        }
      }
    }
  }
}

See also