I am having issues with two Curve methods that does not agree with API documentation and I don't know how to work aroundas as they show stoppers for me ..
Using CorelDRAW X6 (yeah, I know it is old, but still works)
namespace Corel.Interop.CorelDRAW{ [Guid("398C000F-8583-4382-B9A1-4BDF347594AC")] [TypeLibType(4176)] public interface IDrawCurve
[DispId(1610743823)] CurveElement[] GetCurveInfo(); [DispId(1610743824)] int PutCurveInfo(ref CurveElement[] Source, int NumElements = -1);
Now using CorelDRAW Standard 2021 ...
namespace VGCore{ [Guid("B0580019-9AA4-44FD-9547-4F91EB757AC4")] [TypeLibType(4160)] public interface IVGCurve {
[DispId(1610743823)] Array GetCurveInfo(); [DispId(1610743824)] int PutCurveInfo(ref Array Source, int NumElements = -1);
As you can see, it has changes using CurveElement[] type to System.Array which does not match the C# API documentation?
CorelDRAW Graphics Suite 2023
Here is code sample showing the issue, using C#
using System;
using VGCore;
namespace CorelDRAWTest{ class Program { static void CreateTextInCorelDRAW(string text, string fontName, float fontSize) { Type pia_type = Type.GetTypeFromProgID("CorelDRAWStandard.Application.23"); Application app = Activator.CreateInstance(pia_type) as Application; app.Visible = true; Document doc = app.ActiveDocument; if (doc == null) doc = app.CreateDocument(); Shape shape = doc.ActiveLayer.CreateArtisticText( 0.0, 0.0, text, cdrTextLanguage.cdrLanguageMixed, cdrTextCharSet.cdrCharSetMixed, fontName, fontSize, cdrTriState.cdrUndefined, cdrTriState.cdrUndefined, cdrFontLine.cdrMixedFontLine, cdrAlignment.cdrLeftAlignment);
CurveElement[] ce = new CurveElement[4];
ce[0].ElementType = cdrCurveElementType.cdrElementStart; ce[0].PositionX = 0; ce[0].PositionY = 0; ce[1].ElementType = cdrCurveElementType.cdrElementLine; ce[1].PositionX = 2; ce[1].PositionY = 0; ce[2].ElementType = cdrCurveElementType.cdrElementLine; ce[2].PositionX = 1; ce[2].PositionY = 2; ce[3].ElementType = cdrCurveElementType.cdrElementLine; ce[3].PositionX = 0; ce[3].PositionY = 0;
app.ActiveShape.Curve.PutCurveInfo(ref ce, ce.Length);
} static void Main(string[] args) { try { CreateTextInCorelDRAW("Hello, world", "Arial", 24.0f); } catch (Exception ex) { Console.WriteLine("Error occurred: {0}", ex.Message); } } }}