读书人

当test.jpg大小超过Grid大钟头就出现滚

发布时间: 2013-03-26 09:54:33 作者: rapoo

当test.jpg大小超过Grid大小时就出现滚动条,请前辈指导下!先感谢了!
背景:下面一段代码是一个窗口里边放了一幅背景图片test.jpg。
问题:由于我的背景需发动态替换,所以想当test.jpg大小超过Grid大小时就出现滚动条,请前辈指导下!


<UserControl x:Class="LandQualityViewerApplication.AddIns.StatisticsResultWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
mc:Ignorable="d"
d:DesignHeight="411" d:DesignWidth="780">
<toolkit:BusyIndicator x:Name="StatisticsBusy">
<Grid Width="748" Height="322" Name="reportGrid">
<Grid.Background>
<ImageBrush Stretch="None" ImageSource="/taizi.AddIns;component/Images/test.jpg"/>
</Grid.Background>


</Grid>
</toolkit:BusyIndicator>
</UserControl>



[解决办法]
外面套个ScrollViewer应该就可以解决了吧
[解决办法]
引用:
外面套个ScrollViewer应该就可以解决了吧

首先你是将图片作为了grid的background,这样是不会出现滚动条的。
如1楼,加个ScrollViewer。
<Grid Width="748" Height="322" Name="reportGrid">
<ScrollViewer>
<Image Source="/taizi.AddIns;component/Images/test.jpg"/>
</ScrollViewer>
</Grid>

读书人网 >CAD教程

热点推荐