2012-02-13 2 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.B. 나는 또한 이미지를 축소하는 대신 Polyline을 확대하여 해결 방법을 발견했습니다. – Jarvis

관련 문제