1

我正在创建一个带有单个图像和一个多边形覆盖的对话框。问题是图像的比例与多边形的比例不同,所以我想缩小图像以匹配多边形的比例。但是当我使用 RenderTransform/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>
4

1 回答 1

6

LayoutTransform改为应用它。

于 2012-02-13T18:58:29.970 回答