using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WebcamControl;
using System.Drawing.Imaging;
using Microsoft.Expression.Encoder;
using System.Reflection;
namespace SMS
{
/// <summary>
/// Interaction logic for camphoto.xaml
/// </summary>
public partial class camphoto : Window
{
public camphoto()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
Binding bndg_1 = new Binding("SelectedValue");
bndg_1.Source = comboBox1;
webcam1.SetBinding(WebcamControl.Webcam.VideoDeviceProperty, bndg_1);
//set properties
webcam1.PictureFormat = ImageFormat.Jpeg;
webcam1.FrameRate = 30;
webcam1.FrameSize = new System.Drawing.Size(320, 240);
comboBox1.SelectedIndex = 0;
string str = Microsoft.Expression.Encoder.Devices.EncoderDeviceType.Video.ToString();
FindDevice();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void FindDevice()
{
var vidDevice = Microsoft.Expression.Encoder.Devices.EncoderDevices.FindDevices(Microsoft.Expression.Encoder.Devices.EncoderDeviceType.Video);
foreach (var data in vidDevice)
{
comboBox1.Items.Add(data.Name);
}
}
}
}
嗨朋友,这是我的代码,它是网络摄像头的预览。但是当我调试它时会出现一个错误。
“找不到文件异常:无法加载文件或程序集'Microsoft.Expression.Encoder,Version = 4.0.0.0,Culture = Neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。系统找不到指定的文件。”
我已经添加了Microsoft.Expression.Encoder
对项目参考的参考。但我不明白它为什么会来。请帮我。