Beispiel #1
0
        private void doSmartTrimMark(object sender, RoutedEventArgs e)
        {
            corelApp.ActiveDocument.Unit = cdrUnit.cdrMillimeter;

            corel.Rect rect = new corel.Rect();
            ShapeRange sr   = new ShapeRange();

            sr = corelApp.ActiveSelectionRange;
            corel.Shape  line;
            OutlineStyle oStyle = corelApp.OutlineStyles[0];

            foreach (corel.Shape s in sr)
            {
                rect = s.BoundingBox;
                if (checkPoint(sr, rect.Left + 1, rect.Bottom - 4))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Left + 1, rect.Bottom, rect.Left + 1, rect.Bottom - 4);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
                if (checkPoint(sr, rect.Right - 1, rect.Bottom - 4))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Right - 1, rect.Bottom, rect.Right - 1, rect.Bottom - 4);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
                if (checkPoint(sr, rect.Left - 4, rect.Bottom + 1))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Left, rect.Bottom + 1, rect.Left - 4, rect.Bottom + 1);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
                if (checkPoint(sr, rect.Left - 4, rect.Top - 1))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Left, rect.Top - 1, rect.Left - 4, rect.Top - 1);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
                if (checkPoint(sr, rect.Left + 1, rect.Top + 4))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Left + 1, rect.Top, rect.Left + 1, rect.Top + 4);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
                if (checkPoint(sr, rect.Right - 1, rect.Top + 4))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Right - 1, rect.Top, rect.Right - 1, rect.Top + 4);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
                if (checkPoint(sr, rect.Right + 4, rect.Top - 1))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Right, rect.Top - 1, rect.Right + 4, rect.Top - 1);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
                if (checkPoint(sr, rect.Right + 4, rect.Bottom + 1))
                {
                    line = corelApp.ActiveLayer.CreateLineSegment(rect.Right, rect.Bottom + 1, rect.Right + 4, rect.Bottom + 1);
                    line.Outline.SetProperties(0.0762, oStyle, corelApp.CreateRegistrationColor());
                }
            }
        }
Beispiel #2
0
 bool checkPoint(ShapeRange sr, double x, double y)
 {
     foreach (corel.Shape s in sr)
     {
         corel.Rect r = s.BoundingBox;
         if (r.IsPointInside(x, y))
         {
             return(false);
         }
     }
     return(true);
 }