开发工具与关键技术:Visual Studio2015 WPF
撰写时间:2019年6月24日
//浏览按钮
private void btn_File_Click(object sender, RoutedEventArgs e)
{
//声明两个局部变量
Stream phpto = null;
int length;
//打开(文件框)
OpenFileDialog File = new OpenFileDialog();
//允许用户选择多个文件
File.Multiselect = true;//允许多选图片
//筛选文件类型(提示)
File.Filter = "ALL Image Files|*.*";
//显示对话框
if ((bool)File.ShowDialog())
{
//选定的文件(选定的文件打开只读流)
if ((phpto = File.OpenFile()) != null)
{
//获取文件长度(用字节表示的流长度)
length = (int)phpto.Length;
//声明数组
byte[] bytes = new byte[length];
//读取文件(字节数组,从零开始的字节偏移量,