wpf upload pictures

//上传图片
List<byte[]> lstBytes = new List<byte[]>();
private void Click_01(object sender, RoutedEventArgs e)
{
lstBytes.Clear();//清空数组
Stream photo = null;
int length;
Microsoft.Win32.OpenFileDialog ofWenJian = new Microsoft.Win32.OpenFileDialog();
ofWenJian.Multiselect = true;
ofWenJian.Filter = “ALL Image Files|.”;
if ((bool)ofWenJian.ShowDialog() == true)
{
if ((photo = ofWenJian.OpenFile()) != null)
{
length = (int)photo.Length;
byte[] bytes = new byte[length];
photo.Read(bytes, 0, length);
lstBytes.Add(bytes);
BitmapImage images = new BitmapImage(new Uri(ofWenJian.FileName));
Images = SImg_02.ImageSource;
Update_Img_State = to true;
}
}
the else MyCustomControlLibrary.MMessageBox.ShowAlert ( "No photos selected", Orientation.Horizontal, null, "# FFBDE1FF", to false, to true, 2);
}

Published 115 original articles · won praise 36 · views 9900

Guess you like

Origin blog.csdn.net/weixin_44548307/article/details/102908940