2014-02-18 38 views
1

我想在Expression Blend 4中「繪製」一個簡單的柱面路徑,而且我似乎無法完全理解它。在Expression Blend 4中繪製柱面路徑

(1)I開始了通過添加兩個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)接下來,我選擇了頂部EllipsePath從步驟2得到,然後執行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到整個事情。

回答

1

不知道如何在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" /> 
+0

看起來不錯!你是親手做這個的嗎?你用什麼方法提出幾何? –

+0

是的,這是手工完成的。你只需要讓自己熟悉[路徑標記語法](http://msdn.microsoft.com/en-us/library/ms752293.aspx)。 – Clemens

+0

如果你得到一個小圓線伸出圓圈的終點,它可以通過添加StrokeLineJoin =「斜角」 – Tom

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 
       "/>