2013-03-21 16 views
-1

我有使用WPF Path對象下面的代碼。我從具有大量免費圖標的Syncfusion MetroStudio 2中獲得幾何數據。但是,每當我嘗試使用它們時,它們都會被切斷。下面的圖標應該顯示一個房子,但在下面的邊框內被切斷。我的路徑有問題嗎?爲什麼下面的WPF路徑的切關

<Grid> 
    <Grid.Resources> 
    <Geometry x:Key="HomeGeometry">M31.427,15.523L53.103,34.871 53.103,59.723C53.088,60.666 52.466,61.263 51.961,61.544 51.426,61.845 50.850,61.972 50.232,61.976L38.688,61.976C38.290,61.976 37.902,61.821 37.619,61.544 37.340,61.272 37.179,60.890 37.179,60.502L37.179,48.548 25.677,48.548 25.677,60.502C25.677,60.890 25.514,61.272 25.235,61.544 24.953,61.821 24.564,61.976 24.167,61.976L12.622,61.976C12.008,61.972 11.428,61.845 10.895,61.544 10.390,61.263 9.767,60.666 9.752,59.723L9.752,34.871z M31.430,0C32.412,0,33.395,0.347,34.172,1.042L61.536,25.469C63.191,26.947 63.306,29.454 61.791,31.072 60.273,32.685 57.703,32.796 56.048,31.319L31.427,9.342 6.806,31.319C6.024,32.015 5.043,32.358 4.067,32.358 2.964,32.358 1.868,31.925 1.065,31.072L1.062,31.066C-0.447,29.454,-0.335,26.945,1.319,25.469L28.686,1.042C29.464,0.347,30.447,0,31.430,0z 
    </Geometry> 
    </Grid.Resources> 
    <Border 
    Width="50" BorderBrush="LightBlue" 
    Height="50" BorderThickness="2" 
    HorizontalAlignment="Stretch" 
    VerticalAlignment="Stretch" 
    Focusable="False"> 
    <Path Data="{StaticResource HomeGeometry}" Fill="Red"/> 
    </Border> 

回答

2

我想你想要的是

... 
<Path Data="{StaticResource HomeGeometry}" Fill="Red" Stretch="Uniform"/> 
... 
1

enter image description here

正如我們所看到的,你的邊界設置爲寬度= 50,身高= 50,我們清楚地看到你的圖標比那更大。

你的代碼應該是:

<Border 
    Width="64" BorderBrush="LightBlue" 
    Height="64" BorderThickness="2" 
    HorizontalAlignment="Stretch" 
    VerticalAlignment="Stretch" 
    Focusable="False"> 
    <Path Data="{StaticResource HomeGeometry}" Fill="Red"/> 
</Border> 

編輯:

或者,如果你希望你的圖標是50×50,做什麼「500 - 內部..」之稱,它會伸展你的圖標50×50通過添加彈力=「統一」

相關問題