1

在下面的代码中,当我启动应用程序时,图像“imgNew”没有显示在画布上,所有其他图像都显示。它是倒数第四个:

<Image Height="100" HorizontalAlignment="Left" Margin="12,656,0,0" Name="imgNew" Source="/Elementals;component/NoughtsAndCrosses/NACImages/N%26C_new_1.png" Stretch="Fill" Tap="imgNew_Tap" VerticalAlignment="Top" Width="150" />

 <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <Grid.Background>
        <ImageBrush ImageSource="/Elementals;component/Main/HomeImages/bg_fire_3.png" />
    </Grid.Background>
    <Image Height="458" HorizontalAlignment="Left" Margin="12,154,0,0" Name="imgGrid" Source="/Elementals;component/NoughtsAndCrosses/NACImages/Grid.png" Stretch="Fill" VerticalAlignment="Top" Width="458" />
    <Image Height="120" HorizontalAlignment="Left" Margin="27,171,0,0" Name="LeftTop" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="LeftTop_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="181,171,0,0" Name="MiddleTop" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="MiddleTop_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="335,171,0,0" Name="RightTop" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="RightTop_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="335,479,0,0" Name="RightBottom" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="RightBottom_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="181,479,0,0" Name="MiddleBottom" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="MiddleBottom_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="27,479,0,0" Name="LeftBottom" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="LeftBottom_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="335,325,0,0" Name="RightMiddle" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="RightMiddle_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="181,325,0,0" Name="MiddleMiddle" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="MiddleMiddle_Tap" VerticalAlignment="Top" Width="120" />
    <Image Height="120" HorizontalAlignment="Left" Margin="27,325,0,0" Name="LeftMiddle" Source="/Elementals;component/NoughtsAndCrosses/NACImages/empty.png" Stretch="Fill" Tap="LeftMiddle_Tap" VerticalAlignment="Top" Width="120" />
    <TextBlock Height="30" HorizontalAlignment="Left" Margin="10,46,0,0" Name="lblPlayerX" Text="X Points:" VerticalAlignment="Top" />
    <TextBlock Height="30" HorizontalAlignment="Left" Margin="11,10,0,0" Name="lblPlayerO" Text="O Points:" VerticalAlignment="Top" />
    <Image Height="100" HorizontalAlignment="Left" Margin="12,656,0,0" Name="imgNew" Source="/Elementals;component/NoughtsAndCrosses/NACImages/N%26C_new_1.png" Stretch="Fill" Tap="imgNew_Tap" VerticalAlignment="Top" Width="150" />
    <Image Height="178" HorizontalAlignment="Left" Margin="56,325,0,0" Name="lblX" Source="/Elementals;component/NoughtsAndCrosses/NACImages/WHo_First_3.png" Stretch="Fill" VerticalAlignment="Top" Width="180" Tap="lblX_Tap" />
    <Image Height="138" HorizontalAlignment="Left" Margin="35,154,0,0" Name="lblWhosGo" Source="/Elementals;component/NoughtsAndCrosses/NACImages/WHo_First_2.png" Stretch="Fill" VerticalAlignment="Top" Width="420" />
    <Image Height="180" HorizontalAlignment="Left" Margin="251,325,0,0" Name="lblO" Source="/Elementals;component/NoughtsAndCrosses/NACImages/WHo_First_4.png" Stretch="Fill" VerticalAlignment="Top" Width="192" Tap="lblO_Tap" />

4

2 回答 2

1

您是否将“构建操作”设置为该图像的内容?确保你做到了

于 2012-04-08T15:50:29.280 回答
1

我猜它被文件名中的 HTML 编码字符弄乱了。%26 与 & 符号相同&,这很可能会导致您出现问题。我建议您将文件重命名为不带特殊字符的名称。

于 2012-04-08T15:52:17.423 回答