Ejemplo n.º 1
0
 private void btnCrSemiLine_Click(object sender, RoutedEventArgs e)
 {
     if (checkActive())
     {
         MessageBox.Show(err, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     try
     {
         Size       s    = new Size(app.ActiveSelection.SizeWidth, app.ActiveSelection.SizeHeight);
         ShapeRange orSh = app.ActiveSelectionRange;
         Shape      sh   = app.ActiveLayer.CreateRectangle(orSh.LeftX, orSh.TopY, orSh.RightX, orSh.BottomY);
         sh.ConvertToCurves();
         Curve   c  = app.ActiveDocument.CreateCurve();
         SubPath ss = c.CreateSubPath(orSh.RightX, orSh.BottomY);
         ss.AppendCurveSegment(orSh.LeftX, orSh.BottomY);
         ss.AppendCurveSegment(orSh.LeftX, orSh.TopY);
         sh.Curve.CopyAssign(c);
         orSh.Delete();
         sh.CreateSelection();
         orSh = app.ActiveSelectionRange;
         double space = 0;
         for (int i = 1; i < numRow.Value; i++)
         {
             space += s.y;
             orSh.AddRange(app.ActiveSelectionRange.Duplicate(0, -space));
         }
         orSh.CreateSelection();
         space = 0;
         for (int j = 1; j < numCol.Value; j++)
         {
             space += s.x;
             orSh.AddRange(app.ActiveSelectionRange.Duplicate(space, 0));
         }
         orSh.Add(app.ActiveLayer.CreateLineSegment(orSh.PositionX, orSh.PositionY, orSh.PositionX + orSh.SizeWidth, orSh.PositionY));
         orSh.Add(app.ActiveLayer.CreateLineSegment(orSh.PositionX + orSh.SizeWidth, orSh.PositionY, orSh.PositionX + orSh.SizeWidth, orSh.PositionY - orSh.SizeHeight));
         orSh.Group();
         app.ActiveLayer.CreateRectangle(orSh.LeftX, orSh.TopY, orSh.RightX, orSh.BottomY).CreateSelection();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\n" + ex.Source, "Lỗi");
     }
 }
Ejemplo n.º 2
0
        private void createMark()
        {
            double mSize = 1.6;
            double mWid  = 0.06;

            app.ActiveDocument.Unit = cdrUnit.cdrCentimeter;
            ShapeRange orSh     = app.ActiveSelectionRange;
            Shape      botRight = app.ActiveLayer.CreateRectangle(0, 0, mSize, mSize);

            botRight.ConvertToCurves();
            Curve   c  = app.ActiveDocument.CreateCurve();
            SubPath ss = c.CreateSubPath(mSize, mSize);

            ss.AppendCurveSegment(0, mSize);
            ss.AppendCurveSegment(0, 0);
            botRight.Curve.CopyAssign(c);
            botRight.Outline.Width = mWid;
            botRight.Outline.Color.CMYKAssign(30, 30, 30, 100);
            Shape topRight = botRight.Duplicate(0, 0);

            topRight.Flip(cdrFlipAxes.cdrFlipVertical);
            topRight.AddToSelection();
            Shape topLeft = botRight.Duplicate(0, 0);

            topLeft.Flip(cdrFlipAxes.cdrFlipBoth);
            topLeft.AddToSelection();
            Shape botLeft = botRight.Duplicate(0, 0);

            botLeft.Flip(cdrFlipAxes.cdrFlipHorizontal);
            botLeft.AddToSelection();
            botRight.Move(orSh.PositionX + orSh.SizeWidth, orSh.PositionY - orSh.SizeHeight - mSize);
            topRight.Move(orSh.PositionX + orSh.SizeWidth, orSh.PositionY);
            topLeft.Move(orSh.PositionX - mSize, orSh.PositionY);
            botLeft.Move(orSh.PositionX - mSize, orSh.PositionY - orSh.SizeHeight - mSize);
            Shape mark = app.ActiveSelectionRange.Combine();

            mark.Name = "FineCut_TomboGroup";
            orSh.Delete();
        }