投稿者 snowmansnow  (社会人) 投稿日時 2021/2/23 18:45:20
文字制限のため、追加投稿いたします。
問題の削除の部分です


Private Sub CommandButton37_Click()
 Dim myStroke As Object
 Dim c As Variant
     Dim dels() As Long
   
    ReDim dels(0)
    MsgBox InkPicture2.ink.strokes.Count
   For Each myStroke In InkPicture2.ink.strokes
    If InkPicture2.ink.strokes(myStroke.id - 1).DrawingAttributes.Color <> 0 Then
    ReDim dels(UBound(dels) + 1)
     dels(UBound(dels) - 1) = myStroke.id
    MsgBox (UBound(dels)) & "-" & dels(UBound(dels) - 1)
    Else
    End If
 Next
    InkPicture2.AutoRedraw = True
    MsgBox (UBound(dels))

   Dim strokesd As IInkStrokeDisp
   
   Dim strokesToDelete As MSINKAUTLib.InkStrokes
  
   Set strokesToDelete = InkPicture2.ink.CreateStrokes()

   For d = (UBound(dels) - 1) To 1 Step -1
 '  Set strokesd = InkPicture2.ink.strokes(10)
    MsgBox d & "=" & dels(d)
 '  InkPicture2.ink.strokes.Remove strokesd
   InkPicture2.ink.DeleteStroke InkPicture2.ink.strokes(29)
   InkPicture2.AutoRedraw = True
  Next

'インクを足す事はできる・・・
Dim strokes As MSINKAUTLib.InkStrokes
Set combinedInk = InkPicture2.ink
Set strokes = InkPicture3.ink.strokes
iret = combinedInk.AddStrokesAtRectangle(strokes, strokes.GetBoundingBox())
Set strokes = InkPicture4.ink.strokes
iret = combinedInk.AddStrokesAtRectangle(strokes, strokes.GetBoundingBox())
'https://microsoft.public.windows.tabletpc.developer.narkive.com/xeodljDK/rendering-ink-from-multiple-inkpictures-in-the-same-form


InkPicture2.AutoRedraw = True

End Sub

よろしくお願いします