2016-11-21 105 views
0

我想從我的(ImageBox)中的計算機的默認攝像頭節目製作實時饋送,名稱爲imgCamUser; 但我看到許多錯誤錯誤(方法必須有返回類型)&&('是'字段',但用作'類型')

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 
using Emgu.Util; 
using Emgu.CV.UI; 
using Emgu.CV; 
namespace mmmmmm 
{ 
    public partial class Form1 : Form 
    { 
     public Form1() 
     { 
      InitializeComponent(); 
     } 
     private void pictureBox1_Click(object sender, EventArgs e) 
     { 
      private Capture capture; 
capture = new Capture(); 
imgCamUser.Image = capture.QueryFrame(); 
     } 
    } 
} 

但我有這些錯誤 this error

this list of errors

+1

在'private Capture'中刪除'private';應該只是'Capture capture;' –

回答

1

只要寫

​​

,而不是

private Capture capture; 
capture = new Capture(); 

因爲在方法中聲明的變量只能在這個方法內部看到,所以在聲明它們是私有的,公共的或者保護的時候是沒有意義的。

+0

謝謝,但是返回新錯誤「錯誤不能隱式地將類型'Emgu.CV.Mat'轉換爲'System.Drawing.Image' –

+0

這是另一個問題 – Toshi

相關問題