博客
关于我
UWP 调用系统拍照程序
阅读量:427 次
发布时间:2019-03-06

本文共 747 字,大约阅读时间需要 2 分钟。

当需要用户选择照片时,一般有两种方法:

1、从本地磁盘选择

2、调用照相机拍照

 

这次就说一下第二种方法,毕竟第一种大家都会。

先看下效果

 

 

 

如图所示,点击拍照后,会弹出系统照相机界面,在手机上,会打开相机app

 

CameraCaptureUI captureUI = new CameraCaptureUI();                captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;                captureUI.PhotoSettings.AllowCropping = false;                //captureUI.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.Large3M;                StorageFile photoFile = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);                if (photoFile != null)                {                      //TODO:......                }

 

当然啦,如果你发现CameraCaptureUI提示错误,现在的vs都这么智能,你点击以下就会给你自动引用using Windows.Media.Capture;

 

如果设置AllowCropping为true,在拍照后,会叫你继续裁剪图片的。

 

最后返回的都是StorageFile。

转载地址:http://quruz.baihongyu.com/

你可能感兴趣的文章
Nginx 配置清单(一篇够用)
查看>>
Nginx 配置解析:从基础到高级应用指南
查看>>
Nginx 集成Zipkin服务链路追踪
查看>>
nginx 集群配置方式 静态文件处理
查看>>
nginx+php的搭建
查看>>
nginx+tomcat+memcached
查看>>
Nginx+Tomcat实现动静分离
查看>>
nginx+Tomcat性能监控
查看>>
nginx+uwsgi+django
查看>>
nginx+vsftp搭建图片服务器
查看>>
Nginx-http-flv-module流媒体服务器搭建+模拟推流+flv.js在前端html和Vue中播放HTTP-FLV视频流
查看>>
nginx-vts + prometheus 监控nginx
查看>>
nginx: [emerg] getpwnam(“www”) failed 错误处理方法
查看>>
nginx:Error ./configure: error: the HTTP rewrite module requires the PCRE library
查看>>
Nginx、HAProxy、LVS
查看>>
Nginx下配置codeigniter框架方法
查看>>
Nginx中使用expires指令实现配置浏览器缓存
查看>>
Nginx之二:nginx.conf简单配置(参数详解)
查看>>
Nginx从入门到精通
查看>>
Nginx代理websocket配置(解决websocket异常断开连接tcp连接不断问题)
查看>>