嗨,朋友们,
撰写如此简单的文章的原因是,经过大量搜索之后,我才知道没有太多人意识到Silverlight中没有Picturebox,而替代品是Imagebox。
这是如何使用Imagebox的基本示例。
This you can code on click event of button or anywhere according to your requirement,it will open a dialog box and let u select a image.
Here image1 is my Imagebox name.
OpenFileDialog objFileDialog = new OpenFileDialog();
bool? IsSelected = objFileDialog.ShowDialog();
objFileDialog.Filter = "Pictures (*.jpg)|*.jpg";
objFileDialog.FilterIndex = 1;
if (IsSelected == true)
{
BitmapImage bitImage = new BitmapImage();
bitImage.SetSource(objFileDialog.File.OpenRead());
image1.Source = bitImage;
//Image1 is object of Image
}
From: https://bytes.com/topic/software-development/insights/916646-using-imagebox-silverlight-c-net-code
本文介绍在Silverlight环境中,由于不存在PictureBox,如何利用Imagebox进行图片加载和显示的方法。通过示例代码展示了如何使用Imagebox从文件对话框选择图片,并将其显示在界面上。
508

被折叠的 条评论
为什么被折叠?



