共用方式為


Shadow Class

Defines the Shadow Class.When the object is serialized out as xml, its qualified name is v:shadow.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Vml.Shadow

Namespace:  DocumentFormat.OpenXml.Vml
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Class Shadow _
    Inherits OpenXmlLeafElement
'Usage
Dim instance As Shadow
public class Shadow : OpenXmlLeafElement

Remarks

[ISO/IEC 29500-1 1st Edition]

14.1.2.18 shadow (Shadow Effect)

This element adds shadow effects to a shape. The on attribute shall be true for the shadow to be displayed.

[Example:

<v:shadow on="true" type="perspective"
  matrix="1.25,-2,,1.5,,.000001"
  offset="38pt,-6pt">
</v:shadow>

DocumentFormat.OpenXml.Vml.Shadow-image001

end example]

Parent Elements

arc (§14.1.2.1); background (Part 1, §17.2.1); curve (§14.1.2.3); group (§14.1.2.7); image (§14.1.2.10); line (§14.1.2.12); object (Part 1, §17.3.3.19); oval (§14.1.2.13); pict (§9.2.2.2); pict (§9.5.1); polyline (§14.1.2.15); rect (§14.1.2.16); roundrect (§14.1.2.17); shape (§14.1.2.19); shapedefaults (§14.2.2.28); shapetype (§14.1.2.20)

Attributes

Description

color (Shadow Primary Color)

Specifies the color of the primary shadow. Default is gray (RGB 128,128,128).

[Example:

<v:shadow on="true" color="green">
</v:shadow>

Applied to a simple square the shadow looks like this:

DocumentFormat.OpenXml.Vml.Shadow-image002

end example]

The possible values for this attribute are defined by the ST_ColorType simple type (§15.1.2.3).

color2 (Shadow Secondary Color)

Specifies the color of the second shadow, or highlight in an embossed or engraved shadow. Default is light gray (RGB 203,203,203).

[Example:

<v:shadow on="true" type="double"
  color="green" color2="blue">
</v:shadow>
DocumentFormat.OpenXml.Vml.Shadow-image003

end example]

The possible values for this attribute are defined by the ST_ColorType simple type (§15.1.2.3).

id (Unique Identifier)

Specifies a unique identifier that can be used to reference a VML object.

Default is no value.

[Example:

<v:shape … id="myShape" … >
</v:shape>

end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

matrix (Shadow Perspective Matrix)

Specifies a perspective transform for a shadow. Default is no value.

The matrix is given in the form "" where s = scale and p = perspective. If the offset attribute is in absolute units then are in 1/EMU units; otherwise they are an inverse fraction of the shape size.

[Example: The following snippets explain the matrix parameters. The shadow is applied to a simple square with no fill and a red stroke color (note there is a default shadow offset):

DocumentFormat.OpenXml.Vml.Shadow-image004

specify scaling factors for the x and y dimensions:

DocumentFormat.OpenXml.Vml.Shadow-image005DocumentFormat.OpenXml.Vml.Shadow-image006

specify skews in the x and y dimensions:

DocumentFormat.OpenXml.Vml.Shadow-image007DocumentFormat.OpenXml.Vml.Shadow-image008

effectively set the perspective trapezoid skews along the x and y dimensions:

DocumentFormat.OpenXml.Vml.Shadow-image009DocumentFormat.OpenXml.Vml.Shadow-image010

end example]

[Example:

<v:shadow on="true" type="perspective"
  matrix="1.25,-2,,1.5,,.000001"
  offset="38pt,-6pt">
</v:shadow>
DocumentFormat.OpenXml.Vml.Shadow-image011

end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

obscured (Shadow Transparency)

Specifies whether a shadow is transparent. Default is false. If true, the shadow is transparent if there is no fill on the shape.

[Example:

<v:background fillcolor="yellow"/>
<v:shape style="width:50;height:50"
  filled="false" fillcolor="red"
  path="m 0,0 l 0,1000 1000,1000 1000,0 x e">
  <v:shadow on="true" offset="50%,25%"
    obscured="true">
  </v:shadow>
</v:shape>
DocumentFormat.OpenXml.Vml.Shadow-image012

end example]

The possible values for this attribute are defined by the ST_TrueFalse simple type (§15.1.2.5).

offset (Shadow Primary Offset)

Specifies the primary shadow's x,y offset from the shape's location. Default is "2pt,2pt".

Values are either an absolute measurement or a fractional value of the shape dimensions, from –50% to 50%.

[Example:

<v:shadow on="true" offset="50%,25%">
</v:shadow>
DocumentFormat.OpenXml.Vml.Shadow-image005

end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

offset2 (Shadow Secondary Offset)

Specifies the secondary shadow's x,y offset from the shape's location. Default is "-2pt,-2pt".

[Example:

<v:shadow type="double" on="true" 
  color="blue" offset="10pt,5pt"
  color2="red" offset2="-10pt,-5pt">
</v:shadow>
DocumentFormat.OpenXml.Vml.Shadow-image013

end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

on (Shadow Toggle)

Specifies whether to show a shadow. Default is true.

The possible values for this attribute are defined by the ST_TrueFalse simple type (§15.1.2.5).

opacity (Shadow Opacity)

Specifies the opacity of the shadow. Default is 1. This numeric value can also be specified in 1/65536-ths if a trailing "f" is supplied. [Example: For example, a value of "52429f" represents 52429/65536 or 0.8. end example]

[Example:

<v:shadow type="double" on="true" opacity=".5"
  color="blue" offset="10pt,5pt"
  color2="red" offset2="-10pt,-5pt">
</v:shadow>
DocumentFormat.OpenXml.Vml.Shadow-image014

end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

origin (Shadow Origin)

Specifies the center of the shadow relative to the shape's origin. Specified as a pair of fractional values of the shape dimensions, ranging from 50% to -50%. Default is "0,0".

[Example: This example is unchanged from above except for the addition of the origin attribute:

<v:shadow on="true" type="perspective"
  matrix="1.25,-2,,1.5,,.000001"
  offset="38pt,-6pt" origin="10%,-10%">
</v:shadow>
DocumentFormat.OpenXml.Vml.Shadow-image015

end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

type (Shadow Type)

Specifies the kind ofshadow. Default is single. Allowed values are:

Value

Description

single

Single shadow.

double

Double shadow. color2 and offset2 are used for the second shadow's color and offset.

perspective

Perspective shadow.

shaperelative

The shadow is created relative to the shape.

drawingrelative

The shadow is created relative to the drawing.

emboss

The shadow has an embossed look.

The possible values for this attribute are defined by the ST_ShadowType simple type (§14.1.3.6).

[Note: The W3C XML Schema definition of this element’s content model (CT_Shadow) is located in §A.6.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Shadow Members

DocumentFormat.OpenXml.Vml Namespace