在Expression Blend 4中绘制圆柱路径

时间:2014-02-18 16:07:22

标签: wpf silverlight xaml expression-blend expression-blend-4

我试图在Expression Blend 4中“绘制”一个简单的圆柱路径,而我似乎无法将其完全正确。

(1)我首先添加了两个Ellipses和一个Rectangle

<Grid Background="Transparent">
    <Ellipse Fill="Transparent" Height="13.25" Margin="352,0,352,227" Stroke="Black" VerticalAlignment="Bottom"/>
    <Rectangle Fill="Transparent" Margin="352,216,352,233" Stroke="Black"/>
    <Ellipse Fill="Transparent" Height="13.25" Margin="352,209.625,352,0" Stroke="Black" VerticalAlignment="Top"/>
</Grid>

enter image description here

(2)接下来,我选择了底部EllipseRectangle,并执行了Combine -> Unite

<Grid Background="Transparent">
    <Path Data="M0.5,0.5 L47.5,0.5 47.5,47.375 47.5,47.5 47.493931,47.5 47.492325,47.533089 C47.170608,50.84277 36.775898,53.5 24,53.5 11.2241,53.5 0.82939076,50.84277 0.50767487,47.533089 L0.50606853,47.5 0.5,47.5 0.5,47.375 z" Fill="Transparent" Margin="352,216,352,227" Stretch="Fill" Stroke="Black"/>
    <Ellipse Fill="Transparent" Height="13.25" Margin="352,209.625,352,0" Stroke="Black" VerticalAlignment="Top"/>
</Grid>

enter image description here

(3)接下来,我选择了从步骤2得到的顶部EllipsePath,然后执行了Path -> Make Compound Path。然后使用直接选择工具,我通过顶部Ellipse删除了线切割。在我尝试将Fill="Green"应用于Path之前,它看起来不错。

<Grid Background="Transparent">
    <Path Fill="Green" Data="M47.5,6.875 L47.5,53.75 47.5,53.875 47.493931,53.875 47.492325,53.908089 C47.170608,57.21777 36.775898,59.875 24,59.875 11.2241,59.875 0.82939076,57.21777 0.50767487,53.908089 L0.50606853,53.875 0.5,53.875 0.5,53.75 0.5,6.875 M47.5,6.625 C47.5,10.007744 36.978692,12.75 24,12.75 11.021308,12.75 0.5,10.007744 0.5,6.625 0.5,3.2422559 11.021308,0.5 24,0.5 36.978692,0.5 47.5,3.2422559 47.5,6.625 z" Margin="352,209.625,352,227" Stretch="Fill" Stroke="Black"/>
</Grid>

enter image description here

我尝试了各种各样的操作,但我不能为我的生活弄清楚如何获得一个圆柱Path,我可以将Fill应用于整个事物。

2 个答案:

答案 0 :(得分:2)

不知道如何在Blend中做到这一点,但是这个数字可以由两个弧组成(上半部分)上半部分,一条线向下,一条弧形用于下半部椭圆,一条线向上和上椭圆的一半的最终弧:

<Path Stroke="Black" Fill="LightGreen" Stretch="Fill" Data="
    M0,0
    A50,10 0 0 0 100,0
    A50,10 0 0 0 0,0 
    M100,00 L100,100
    A50,10 0 0 1 0,100
    L0,0
    A50,10 0 0 0 100,0" />

答案 1 :(得分:0)

有没有办法让它倾斜?我试图改变它,使其近似等距的外观,但无法弄明白。要走的路要走圆圈吗?所以双方是10和4或类似(如在时钟上)?

正在研究这个问题,但我要么在左下角重叠,要么在圆圈外面看一些像素。

Where the circles meet the lines are not completely aligned, and I can't shift it more to the side or the line will intersect the circle.

<Path Stroke="Black" Fill="AliceBlue" Data="
              M 0 0
              A 45,40 0 0 0 100,0 
              A 45,40 0 0 0 0,0 
              L 15,-100
              A 45,40 0 0 1 115,-100
              L 100,0
              A 45,40 0 0 0 0,0
              "/>
编辑:我现在或多或少地管理,一些小调整,应该在那里,诀窍是在添加线之前旋转圆圈。

Improved version

            <Path Stroke="Black" Fill="AliceBlue" Data="
              M 0 0
              A 45,40 0 0 0 100,45 
              A 45,40 0 0 0 0,0 
              L 60,-100
              A 45,40 0 0 1 160,-60
              L 100,45
               A 45,40 0 0 0 0,0
              "/>