2012-02-13 95 views
1

我創建了一個包含單個圖像的對話框,並覆蓋了一個多邊形。問題是圖像的比例與多邊形的比例不同,所以我想縮小圖像以匹配多邊形的比例。但是,當我使用RenderTransform/ScaleTransform標籤時,圖像的大小會在對話框的右側和底部留下空白。是的,疊加層現在可以正常工作,但我希望能夠填充可用空間來填充窗口。圖像上的ScaleTransform留下空白

<Window x:Class="vw.CollImage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Collection Image" Height="700" Width="700" 
    WindowStartupLocation="CenterOwner" Grid.IsSharedSizeScope="False" 
    Icon="Resources\ty.ico"> 

    <Viewbox MinWidth="70" MinHeight="70"> 
     <Grid> 
      <Image Name="imgColl" HorizontalAlignment="Left" VerticalAlignment="Top" Source="{Binding ImageData}"> 
       <Image.RenderTransform> 
        <ScaleTransform ScaleX="0.75" ScaleY="0.75"/> 
       </Image.RenderTransform> 
      </Image> 
      <Polyline Stroke="OrangeRed" StrokeThickness="6" Points="{Binding Coordinates}"/> 
     </Grid> 
    </Viewbox> 
</Window> 

回答

6

將其作爲LayoutTransform代替。

+0

謝謝H.我還發現了一種解決方法,通過擴大折線而不是縮小圖像。 – Jarvis 2012-02-13 19:05:44