【CorelDraw VBA 011例】创建B样条


Sub mCreateBSpline()
    '##创建B样条
    ' Recorded 2021/8/21 星期六
    Dim bs As BSpline
    Dim sh As Shape
    Dim Kg As Boolean
    Set sh = ActiveShape
    Set bs = ActiveDocument.CreateBSpline(sh.Curve.Nodes.Count, True)
    With sh.Curve
        For i = 1 To .Nodes.Count
            If i Mod 2 = 0 Then Kg = True Else Kg = False
            bs.ControlPoints(i).SetProperties .Nodes(i).PositionX, .Nodes(i).PositionY, Kg
        Next i
    End With
    ActiveLayer.CreateBSpline bs
End Sub