您好,登錄后才能下訂單哦!
C#
- public partial class PhontosAndCameras : PhoneApplicationPage
- {
- CameraCaptureTask camera=new CameraCaptureTask();
- PhotoChooserTask photo=new PhotoChooserTask();
- public PhontosAndCameras()
- {
- InitializeComponent();
- camera.Completed += new EventHandler<PhotoResult>(photo_Completed);
- photo.Completed += new EventHandler<PhotoResult>(photo_Completed);
- }
- void photo_Completed(object sender, PhotoResult e)
- {
- BitmapImage bitmap = new BitmapImage();
- bitmap.SetSource(e.ChosenPhoto);
- p_w_picpath2.Source = bitmap;
- path.Text = e.OriginalFileName;
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- camera.Show();
- }
- private void Button_Click_1(object sender, RoutedEventArgs e)
- {
- photo.ShowCamera = true;
- photo.Show();
- }
- }
XAML
- <Grid x:Name="LayoutRoot" Background="Transparent">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <TextBlock Name="path" Text="顯示路徑"></TextBlock>
- <Image Name="p_w_picpath2" Grid.Row="1" ></Image>
- <Button Content="拍照" Grid.Row="2" Width="200" Click="Button_Click"></Button>
- <Button Content="選擇照片" Grid.Row="3" Width="200" Click="Button_Click_1"></Button>
- </Grid>
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。