I would like to find out - without a macro from other programmers :-) the lenght of curve's
In corel i select a simple shape.
Why this not work?
1 2 3 4 5 6 7 8 9
private void Button_Click_1(object sender, RoutedEventArgs e) { corel.Shape selectedShape = corelApp.ActiveSelection; if (selectedShape.Type == corel.cdrShapeType.cdrCurveShape) { double l = selectedShape.Curve.Length; TB_LineLenght.Text = l.ToString(); } }
Now i found a strange effect in textWhen i type 28 Letters (44 objects) it works
But one more letter, it give a strange result
But when i draw 200 rectangles or so, it is no problem when it have more tan 44 objects. The problem is only in the text
This is happening because the ConvertToCurves is now returning a Group of 2 Objects:
You will need to add a check for this and then Ungroup and do your break apart.
In your code you are converting the entire ShapeRange to Curves, but you are in a loop for each shape, so I would change to this to convert the shape to curves.
I would also recommend putting all your new converted curves into a new ShapeRange. It just keeps things cleaning when you are looping. Here is what I came up with. Yes it is in VBA, but you will get the idea:
Dim s As Shape, sInGroup As Shape Dim srSelection As ShapeRange, srUnGrouped As ShapeRange, srCurves As New ShapeRange Set srSelection = ActiveSelectionRange For Each s In srSelection.Shapes s.ConvertToCurves If s.Type = cdrGroupShape Then Set srUnGrouped = s.UngroupAllEx For Each sInGroup In srUnGrouped.Shapes srCurves.AddRange sInGroup.BreakApartEx Next sInGroup Else srCurves.AddRange s.BreakApartEx End If Next s MsgBox srCurves.Count
-Shelby