uwp开发————拍照

来源:互联网 发布:美工多少钱一个月 编辑:程序博客网 时间:2024/04/29 07:13

使用相机拍照并在Image控件中显示

            var cameraCaptureUI = new CameraCaptureUI();            //对相机进行一些设置,还有很多,这里只设置了格式            cameraCaptureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;                        Storage file = await cameraCaptureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);            if (file == null)                return;            BitmapImage bi = new BitmapImage();            using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite))            {                bi.SetSource(stream);            }            MyImage.Source = bi;

myImage是Image控件

1 0
原创粉丝点击