全部显示

Child 属性

       

如果为 True,则图形是子图形或位于图形区域的所有图形都是同一父图形的子图形。MsoTriState,只读。

expression.Child

expression   必需。该表达式返回“应用于”列表中的一个对象。

示例

本示例选择画布中的第一个图形,并且如果所选图形是一个子图形,用指定颜色填充图形。本示例假定活动文档中的第一个图形是包含多个图形的画布。

Sub FillChildShape()

    Dim shpCanvasItem As Shape
    
    'Select the first shape in the drawing canvas
    Set shpCanvasItem = ActiveDocument.Shapes(1).CanvasItems(1)

    'Fill selected shape if it is a child shape
    With shpCanvasItem
        If .Child = msoTrue Then
            .Fill.ForeColor.RGB = RGB(100, 0, 200)
        Else
            MsgBox "This shape is not a child shape."
        End If
    End With

End Sub