windows phone开发之获取摄像头
引入命名空间:
Using Microsoft.Phone.Tasks;
代码段:
void cameraCaptureTask_Completed(object sender, PhotoResult e)
{
BitmapImage bmp = new BitmapImage();
bmp.SetSource(e.ChosenPhoto);//获取返回的图片
image1.Source = bmp;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
CameraCaptureTask cameraCaptureTask = new CameraCaptureTask();
cameraCaptureTask.Show();//打开摄像头程序
cameraCaptureTask.Completed +=
new EventHandler<PhotoResult>(cameraCaptureTask_Completed);//拍照完返回
}
摘自 _亚
补充:移动开发 , Windows Phone ,