< ScaleTransform.ScaleX > < 绑定 ElementName =" sldZoom" 路径 =" Value" 模式 ="OneWay"/> </ ScaleTransform.ScaleX > < ScaleTransform.ScaleY > < 绑定 ElementName =" sldZoom" 路径 =" Value" 模式 =" OneWay"/> </ ScaleTransform.ScaleY ></ScaleTransform></TransformGroup></Image.LayoutTransform></Image></ScrollViewer></DockPanel></Grid></Window>Please tell me the appropraite solution to resize the image on form resize. 解决方案 Hi San S,If you set a fix size to your Image control like: "Height="30959" Width="55723" " and then it will not be resized, if you want to set dynamica size to your image, you could Bind your Image size to your Window,Height="{Binding ElementName=myWindow, Path=ActualHeight}"if you need return the Height after calculate, you could add a Conveter to your Binding. 最好的问候 When I resize the form on runtime, the image is not resize. The code snippet is below: <Window x:Class="TestWA1.Image1"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="Image1" Height="380" Width="610" ResizeMode="CanResize"><Grid><DockPanel x:Name="LayoutRoot" ><ScrollViewer HorizontalScrollBarVisibility="Visible" Name="scrollViewer"VerticalScrollBarVisibility="Visible" Opacity="1" DockPanel.Dock="Top"><Image Source="/TestWA1;component/Img/ASCE98MapNew.bmp"Height="30959" Width="55723"Margin="5,5,5,5" Name="AP_imgMap" Stretch="Fill" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"><Image.LayoutTransform><TransformGroup><ScaleTransform ScaleX="0.01" ScaleY="0.01"/><ScaleTransform><ScaleTransform.ScaleX><Binding ElementName="sldZoom" Path="Value" Mode="OneWay"/></ScaleTransform.ScaleX><ScaleTransform.ScaleY><Binding ElementName="sldZoom" Path="Value" Mode="OneWay"/></ScaleTransform.ScaleY></ScaleTransform></TransformGroup></Image.LayoutTransform></Image></ScrollViewer></DockPanel></Grid></Window>Please tell me the appropraite solution to resize the image on form resize. 解决方案 Hi San S,If you set a fix size to your Image control like: "Height="30959" Width="55723" " and then it will not be resized, if you want to set dynamica size to your image, you could Bind your Image size to your Window,Height="{Binding ElementName=myWindow, Path=ActualHeight}"if you need return the Height after calculate, you could add a Conveter to your Binding. Best regards, 这篇关于如何在表单调整大小上调整图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 07:33