Table of contents
TOC
折叠目录
展开目录

Shape.Id 属性 (PowerPoint)Shape.Id Property (PowerPoint)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

返回一个Long ,标识形状范围。只读的。Returns a Long that identifies the shape or range of shapes. Read-only.

语法Syntax

表达式标识expression. Id

表达式_一个表示一个Shape对象的变量。_expression A variable that represents a Shape object.

返回值Return Value

LongLong

示例Example

本示例在当前演示文稿,添加一个新形状,然后根据Id属性的值填充该形状。This example adds a new shape to the active presentation, then fills the shape according to the value of the Id property.

Sub ShapeID()

    With ActivePresentation.Slides(1).Shapes.AddShape _
            (Type:=msoShape5pointStar, Left:=100, _
            Top:=100, Width:=100, Height:=100)

        Select Case .Id
            Case 0 To 500
                .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)

            Case 500 To 1000
                .Fill.ForeColor.RGB = RGB(Red:=255, Green:=255, Blue:=0)

            Case 1000 To 1500
                .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=255)

            Case 1500 To 2000
                .Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=0)

            Case 2000 To 2500
                .Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=255)

            Case Else
                .Fill.ForeColor.RGB = RGB(Red:=0, Green:=0, Blue:=255)

        End Select
    End With

End Sub

另请参阅See also

概念Concepts

Shape 对象Shape Object

© 2018 Microsoft