设计时图片位置与实际运行时有偏差
图片控件运行时,图片会向右下方偏移,向右偏移10相素,向下偏移50相素,xaml代码如下:
<navigation:Page x:Class="SilverlightApplication3.ProductDetail" 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" mc:Ignorable="d" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" d:DesignWidth="1440" d:DesignHeight="900" Title="商品信息" > <navigation:Page.Background> <ImageBrush ImageSource="/SilverlightApplication3;component/Images/UI稿.jpg" /> </navigation:Page.Background> <Grid x:Name="LayoutRoot"> <Grid.Background> <ImageBrush ImageSource="/SilverlightApplication3;component/Images/UI稿.jpg" /> </Grid.Background> <Image Height="604" HorizontalAlignment="Left" Margin="175,262,0,0" Name="MainImage" Stretch="Fill" VerticalAlignment="Top" Width="656" Source="/SilverlightApplication3;component/Images/2.jpg" MouseLeftButtonUp="MainImage_MouseLeftButtonUp" /> </Grid></navigation:Page>
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
[解决办法]
这个情况不多见,我使用的是VS2010测试,没有出现偏差。
是不是你本身使用了拉伸之类的操作?