共用方式為


CenterX (RotateTransform)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the x-coordinate of the rotation center point.

<object CenterX="Double"  .../>
value = object.CenterX
object.CenterX = value

Property Value

Type: Double

The x-coordinate of the center of rotation.

This property is read/write. The default value is 0.

Managed Equivalent

CenterX

Remarks

The local 0,0 for an object can be offset on a Canvas by using the Canvas.Left and Canvas.Top properties, but this does not count as a transform because the object retains its own local 0,0 for transformation purposes.

When you use a RotateTransform object with the default values of 0 for CenterX and CenterY, the transform rotates the coordinate system for a particular object around its local 0,0. Therefore, depending on the position of the object and other applied transforms, it might not rotate in place (around its center). For example, if an object is already transformed 200 units from 0 along the x-axis, a rotation of 30 degrees can swing the object 30 degrees along a circle that has a radius of 200, which is drawn around its local 0,0. To rotate an object in place, set the CenterX and CenterY of the RotateTransform to the center of the object to rotate.

Applies To

RotateTransform