专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Silverlight

设计时图片位置与实际运行时有偏差,该如何解决

发布时间:2011-06-27 20:16:02 文章来源:www.iduyao.cn 采编人员:星星草
设计时图片位置与实际运行时有偏差
图片控件运行时,图片会向右下方偏移,向右偏移10相素,向下偏移50相素,xaml代码如下:
C# code
<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>


------解决方案--------------------
不知你是不是用的 VS2008 / VS2010 生成的 MainPage.xaml显示你的这个Page,在 MainPage.xaml 中有
XML code

<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" 
                              Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">

------解决方案--------------------
这个情况不多见,我使用的是VS2010测试,没有出现偏差。
是不是你本身使用了拉伸之类的操作?
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: