本文介绍了为什么代码运行时图像不显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
代码运行时,我的图像未显示在图像框中。请帮帮我。
我尝试过:
我的xaml代码:
My image is not showing up in the image box when the code is running. please help me with this.
What I have tried:
My xaml code:
<Canvas HorizontalAlignment="Left" Height="198" Margin="10,59,0,0" VerticalAlignment="Top" Width="144" Background="#FFF9F4F4">
<Image Name="ImgCard" Height="178" Width="112" Canvas.Top="6" Canvas.Left="16"/>
</Canvas>
我的.cs代码:
My .cs code:
BitmapImage myBitmapImage = new BitmapImage();
myBitmapImage.BeginInit();
myBitmapImage.UriSource = new Uri(@"C://image//cards//*.png");
ImageSource imageSource = myBitmapImage;
ImgCard.Source = imageSource;
推荐答案
这篇关于为什么代码运行时图像不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!