您好,登錄后才能下訂單哦!
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>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。