c# imagebox右击
嗨,朋友们,
撰写如此简单的文章的原因是,经过大量搜索后,我才知道没有太多人意识到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
}
翻译自: https://bytes.com/topic/software-development/insights/916646-using-imagebox-silverlight-c-net-code
c# imagebox右击