close

if (SystemState.CameraPresent)
{
CameraCaptureDialog dlg = new CameraCaptureDialog();
dlg.InitialDirectory = "\\";
dlg.Resolution = new Size(1024, 768);
dlg.StillQuality = CameraCaptureStillQuality.High;
if (dlg.ShowDialog() == DialogResult.OK)
{
picPhoto.Image = new Bitmap(dlg.FileName);
MessageBox.Show("Photo at " + dlg.FileName);
}
}
else
{
MessageBox.Show("Camera not found");
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (SystemState.CameraPresent)
{
CameraCaptureDialog dlg = new CameraCaptureDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
picPhoto.Image = new Bitmap(dlg.FileName);
MessageBox.Show("Photo at " + dlg.FileName);
}
}
else
{
MessageBox.Show("Camera not found");
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile;
using Microsoft.WindowsMobile.Status;
using Microsoft.WindowsMobile.Forms;

namespace CameraDetectCS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnPhoto_Click(object sender, EventArgs e)
{
if (SystemState.CameraPresent)
{
CameraCaptureDialog dlg = new CameraCaptureDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
picPhoto.Image = new Bitmap(dlg.FileName);
MessageBox.Show("Photo at " + dlg.FileName);
}
}
else
{
MessageBox.Show("Camera not found");
}
}
}
}

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 11 的頭像
    11

    冠霖的部落格

    11 發表在 痞客邦 留言(0) 人氣()