According to the API documentation I should be able to pass as paramter1 to Curve.PutCurveInfo CurveElement[], this works as expected in CorelDRAW X6, but fails in CorelDRAW 2021.
Here is the code snippet in question:
CurveElement[] curveInfo = CorelDrawUtilities.GeometryToCurveInfo(cdrDoc, cdrUnit.cdrInch, pg); shape.Curve.PutCurveInfo(ref curveInfo);
I put together a quick test:
corel.CurveElement[] ce = new corel.CurveElement[4]; ce[0].ElementType = corel.cdrCurveElementType.cdrElementStart; ce[0].PositionX = 0; ce[0].PositionY = 0; ce[1].ElementType = corel.cdrCurveElementType.cdrElementLine; ce[1].PositionX = 2; ce[1].PositionY = 0; ce[2].ElementType = corel.cdrCurveElementType.cdrElementLine; ce[2].PositionX = 1; ce[2].PositionY = 2; ce[3].ElementType = corel.cdrCurveElementType.cdrElementLine; ce[3].PositionX = 0; ce[3].PositionY = 0; corelApp.ActiveShape.Curve.PutCurveInfo(ce);
And it worked fine for me with CorelDRAW 2021. So I would double check your CurveElement[] and make sure that it is coming for VGCore.
I know I need both the Corel.Interop.CorelDRAW and Corel.Interop.VGCore as references in my project, but which should I use a using, or neoither and always specify which to use?
If you are using recent version or CorelDRAW you no longer need the Corel.Interop.CorelDRAW, you only need to use the Corel.Interop.VGCore