Пример #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());
                }
            }
        }
Пример #2
0
        private Shape DrawLine(Mark mark)
        {
            Shape line;

            corel.Color  color  = corelApp.CreateRegistrationColor();
            OutlineStyle oStyle = corelApp.OutlineStyles[0];
            double       width  = outlineWidth;

            line = corelApp.ActiveLayer.CreateLineSegment(mark.StartPoint.X, mark.StartPoint.Y, mark.EndPoint.X, mark.EndPoint.Y);
            line.Outline.SetProperties(width, oStyle, color);
            line.Fill.ApplyNoFill();
            return(line);
        }