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,版本= 4.0.0.0,文化=中立, 公钥= 31bf3856ad364e35’或它的一个依赖的。 系统找不到指定的文件。“
我已经加入Microsoft.Expression.Encoder
参考项目引用。但我不明白为什么它会到来。请帮帮我。
是的!它已经在项目应用程序属性中选择为.net framework 4.0。没有效果出现。 –
检查参考资料部分是否有不同于'4.0'的版本。 – Saravanan
也尝试清空临时ASP.Net文件夹,然后检查一次 – Saravanan