怎么样剪切一个对象

来源:互联网 发布:而又何羡乎的乎 编辑:程序博客网 时间:2024/04/30 05:57

 

If you only want to display part of an object you can do this through the Clip property. The clip that you define is the area of the object

如果你只想显示对象的一部分,你可以通过Clip属性来达到这个目的。你定义的这个剪切部分是你想呈现的对象区域。

 that you want to be rendered. For example, say you have a rectangle defined like this:

例如,如果你有类似下面的一个矩形区域

<Rectangle Fill="DarkGoldenrod" Height="100" Width="200" StrokeThickness="3" Stroke="Black"></Rectangle>

 

If you only want to show part of the rectangle you can apply a clip region to it like this:

如果你只想显示矩形的一部分,你可以应用一个类似这样的一个剪切区域:

<Rectangle Fill="DarkGoldenrod" Height="100" Width="200" StrokeThickness="3" Stroke="Black">
           
<Rectangle.Clip>
                       <
EllipseGeometry Center="0,0" RadiusX="80" RadiusY="80" />               
            </Rectangle.Clip>

</Rectangle>

You will noticed I used an EllipseGeometry and centered it in the upper-left corner. The result is a 1/4 circle 80x80 in size. In addition to

你可以注意到我使用了EllipseGeometry并且置于左上角位置,这样产生的结果就是四分之一圆的大小。除了ElllipseGeometry你还可以使用下面的4种:

EllipseGeometry you can also use:

1.   RectangleGeometry

2.   GeometryGroup

3.   LineGeometry

4.   PathGeometry

 

原创粉丝点击