投稿者 snowmansnow  (社会人) 投稿日時 2020/4/2 21:05:39
お世話になります。
inkpictureでstrokeをプログラムで追加したいです。

Private Sub CommandButton19_Click()
'http://www.vbforums.com/showthread.php?763319-Drawing-shapes-on-ink-picture 
'★↑参考にしました
    '@@This needs work:
    '
    '   As it is, it seems to only draw 4 of the vertices, not all 8.
    '   Because of this "FitToCurve" produces a mess instead of anything
    '   resembling a circle.

    Dim DrawingAttributes As MSINKAUTLib.InkDrawingAttributes
    Dim Strokes As MSINKAUTLib.InkStrokes
    
    With InkPicture1
        Set DrawingAttributes = .DefaultDrawingAttributes.Clone
        With DrawingAttributes
            .FitToCurve = True
        End With
        .AutoRedraw = False
        With .Ink ※1
            Set Strokes = .CreateStrokes()
            Strokes.Add .CreateStroke(MakePoints(4400, 0, _
                                                 6600, 2200, _
                                                 8800, 4400, _
                                                 6600, 6600, _
                                                 4400, 8800, _
                                                 2200, 6600, _
                                                 0, 4400, _
                                                 2200, 2200, _
                                                 4400, 0), _
                                      Null)
        End With
        With .Ink ※2
            Set Strokes = .CreateStrokes()
            Strokes.Add .CreateStroke(MakePoints(0, 0, _
                                                 8800, 0, _
                                                 8800, 8800, _
                                                 0, 8800, _
                                                 0, 0), _
                                      Null)
        End With
        With .Ink ※3
            Set Strokes = .CreateStrokes()
            Strokes.Add .CreateStroke(MakePoints(0, 0, _
                                                 4400, 0, _
                                                 4400, 4400, _
                                                 0, 4400, _
                                                 0, 0), _
                                      Null)
        End With
        Strokes.ModifyDrawingAttributes DrawingAttributes
        .AutoRedraw = True
    End With
    
    'Flip to Select:
    '@@Ideally we'd select the new Strokes as well but I haven't figured out how yet.
    'optMode(omSelect).Value = True
End Sub
Private Function MakePoints(ParamArray CoordList() As Variant) As Long()
'http://www.vbforums.com/showthread.php?763319-Drawing-shapes-on-ink-picture
    Dim Coords() As Long
    Dim I As Long
    
    ReDim Coords(UBound(CoordList))
    For I = 0 To UBound(CoordList)
        Coords(I) = CoordList(I)
    Next
    MakePoints = Coords
End Function
で、なんとなく追加できるのですが、
※1から※3の、それぞれ単独で描く時とも形が違うようで、
直線以外は、どうデータ表現して、どう書込みデータにするか、わからないです。
お手数かけますが、よろしくお願いします。