繁体   English   中英

设置图像的构建动作属性

[英]Setting image's build action property

我有简单的问题。 我想在按钮上添加图像,有一种情况我无法处理。 在设计器中,一切正常运行,但在调试模式下,按钮内部没有任何痕迹。 我读到我必须将图像的“生成操作”属性设置为“资源”或“内容”,但是我在解决方案资源管理器中没有这些图片,当我单击“显示所有文件,但它们具有奇怪的图标时,我完全可以看到它们”而不是我通常在解决方案资源管理器中看到的一幅图像,并且没有Build Action属性。

我应该以其他方式添加图像吗?

<Button x:Name="loadButton" HorizontalAlignment="Left" Margin="955,0,0,443" Style="{DynamicResource SimpleButton}" VerticalAlignment="Bottom" Width="29" Height="27" FontFamily="Courier New" FontWeight="Bold" Click="loadButton_Click" Background="{x:Null}" BorderBrush="{x:Null}">


        <StackPanel Orientation="Horizontal">
            <Image x:Name="Load" Source="open-map.png"/>
        </StackPanel>

    </Button>
    <CheckBox x:Name="mode" Content="Tryb tworzenia" HorizontalAlignment="Left" Margin="30,292,0,0" VerticalAlignment="Top" FontSize="18.667" Foreground="#FFAC3333" FontFamily="Courier New" IsChecked="True"/>
    <Button x:Name="button1_Copy" HorizontalAlignment="Left" Margin="912,0,0,443" Style="{DynamicResource SimpleButton}" VerticalAlignment="Bottom" Width="29" Height="27" FontFamily="Courier New" FontWeight="Bold" Click="button1_Copy_Click" Background="{x:Null}" BorderBrush="{x:Null}">

        <StackPanel Orientation="Horizontal">
            <Image x:Name="Save" Source="save-icon.png"/>
        </StackPanel>

    </Button>

解决方案资源管理器

感谢进阶

像open-map.png这样的文件不是C#项目的一部分,因此您不能设置任何属性。 右键单击C#项目,然后将文件添加到项目中,然后就可以设置其属性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM