错误84预期的类,委托,枚举,接口或结构

时间:2015-04-18 07:42:44

标签: c#

我有vb.net代码使用捕获卡捕获视频并以一种工作正常的形式显示它。现在我需要将vb.net代码转换为C#代码,而我这样做我得到上面定义的错误。无法使其工作。任何让它运作的想法都会非常感激。这是代码:

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using DirectX.Capture;

namespace CapSampleCs
{
    public partial class MW :System.Windows.Forms.Form 
    {
        #region " Código generado por el Diseñador de Windows Forms "

        public MW()
            : base()
        {

            //El Diseñador de Windows Forms requiere esta llamada.
            InitializeComponent();

            //Call to AddCam to select an available camera
            AddCam AddCamera = new AddCam();
            AddCamera.ShowDialog(this);

            ModCap.CaptureInformation.CaptureInfo.PreviewWindow = this.videoBoard;

            //Define RefreshImage as event handler of FrameCaptureComplete
            ModCap.CaptureInformation.CaptureInfo.FrameCaptureComplete += RefreshImage;

            ModCap.CaptureInformation.Counter = 1;
            ModCap.CaptureInformation.CounterFrames = 1;


            this.Show();

            //Initialization of ConfWindow
            ModCap.CaptureInformation.ConfWindow = new CW();
            ModCap.CaptureInformation.ConfWindow.Refresh();
            ModCap.CaptureInformation.ConfWindow.Show();

        }

        //Form reemplaza a Dispose para limpiar la lista de componentes.
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if ((components != null))
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        //Requerido por el Diseñador de Windows Forms

        private System.ComponentModel.IContainer components;
        //NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
        //Puede modificarse utilizando el Diseñador de Windows Forms. 
        //No lo modifique con el editor de código.
        internal System.Windows.Forms.Panel videoBoard;
        private System.Windows.Forms.Button withEventsField_cmdFrame;
       // internal System.Windows.Forms.Button cmdFrame
        {
            get { return withEventsField_cmdFrame; }
            set
            {
                if (withEventsField_cmdFrame != null)
                {
                    withEventsField_cmdFrame.Click -= cmdFrame_Click;
                }
                withEventsField_cmdFrame = value;
                if (withEventsField_cmdFrame != null)
                {
                    withEventsField_cmdFrame.Click += cmdFrame_Click;
                }
            }
        }
        private System.Windows.Forms.Button withEventsField_cmdStart;
        internal System.Windows.Forms.Button cmdStart
        {
            get { return withEventsField_cmdStart; }
            set
            {
                if (withEventsField_cmdStart != null)
                {
                    withEventsField_cmdStart.Click -= cmdStart_Click;
                }
                withEventsField_cmdStart = value;
                if (withEventsField_cmdStart != null)
                {
                    withEventsField_cmdStart.Click += cmdStart_Click;
                }
            }
        }
        private System.Windows.Forms.Button withEventsField_cmdStop;
        internal System.Windows.Forms.Button cmdStop
        {
            get { return withEventsField_cmdStop; }
            set
            {
                if (withEventsField_cmdStop != null)
                {
                    withEventsField_cmdStop.Click -= cmdStop_Click;
                }
                withEventsField_cmdStop = value;
                if (withEventsField_cmdStop != null)
                {
                    withEventsField_cmdStop.Click += cmdStop_Click;
                }
            }
        }
        internal System.Windows.Forms.PictureBox pcbFrame;
        [System.Diagnostics.DebuggerStepThrough()]
        private void InitializeComponent()
        {
            this.videoBoard = new System.Windows.Forms.Panel();
            this.pcbFrame = new System.Windows.Forms.PictureBox();
            this.cmdStop = new System.Windows.Forms.Button();
            this.cmdStart = new System.Windows.Forms.Button();
            this.cmdFrame = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.pcbFrame)).BeginInit();
            this.SuspendLayout();
            // 
            // videoBoard
            // 
            this.videoBoard.Location = new System.Drawing.Point(2, 0);
            this.videoBoard.Name = "videoBoard";
            this.videoBoard.Size = new System.Drawing.Size(320, 240);
            this.videoBoard.TabIndex = 0;
            // 
            // pcbFrame
            // 
            this.pcbFrame.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.pcbFrame.Location = new System.Drawing.Point(334, 0);
            this.pcbFrame.Name = "pcbFrame";
            this.pcbFrame.Size = new System.Drawing.Size(320, 240);
            this.pcbFrame.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pcbFrame.TabIndex = 4;
            this.pcbFrame.TabStop = false;
            // 
            // cmdStop
            // 
            this.cmdStop.Enabled = false;
            this.cmdStop.Location = new System.Drawing.Point(231, 250);
            this.cmdStop.Name = "cmdStop";
            this.cmdStop.Size = new System.Drawing.Size(75, 23);
            this.cmdStop.TabIndex = 7;
            this.cmdStop.Text = "Stop";
            // 
            // cmdStart
            // 
            this.cmdStart.Location = new System.Drawing.Point(103, 250);
            this.cmdStart.Name = "cmdStart";
            this.cmdStart.Size = new System.Drawing.Size(75, 23);
            this.cmdStart.TabIndex = 6;
            this.cmdStart.Text = "Start";
            // 
            // cmdFrame
            // 
            this.cmdFrame.Location = new System.Drawing.Point(479, 250);
            this.cmdFrame.Name = "cmdFrame";
            this.cmdFrame.Size = new System.Drawing.Size(75, 23);
            this.cmdFrame.TabIndex = 5;
            this.cmdFrame.Text = "Frame";
            // 
            // MW
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(656, 289);
            this.Controls.Add(this.cmdStop);
            this.Controls.Add(this.cmdStart);
            this.Controls.Add(this.cmdFrame);
            this.Controls.Add(this.pcbFrame);
            this.Controls.Add(this.videoBoard);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "MW";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Main Window";
            ((System.ComponentModel.ISupportInitialize)(this.pcbFrame)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        public void RefreshImage(System.Windows.Forms.PictureBox Frame)
        {
            string[] s = null;
            s = ModCap.CaptureInformation.PathVideo.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
            this.pcbFrame.Image = Frame.Image;
            this.pcbFrame.Image.Save(s[0] + Convert.ToString(ModCap.CaptureInformation.CounterFrames) + ".png");
            ModCap.CaptureInformation.CounterFrames += 1;
            this.pcbFrame.Refresh();
        }

        private void cmdStart_Click(object sender, EventArgs e)
        {
            ModCap.CaptureInformation.CaptureInfo.Start();
            cmdStart.Enabled = false;
            cmdStop.Enabled = true;
        }

        private void cmdStop_Click(object sender, EventArgs e)
        {
            ModCap.CaptureInformation.CaptureInfo.Stop();
            ModCap.ConfParamCam();
            ModCap.PrepareCam(ModCap.CaptureInformation.PathVideo);
            cmdStart.Enabled = true;
            cmdStop.Enabled = false;
        }

        private void cmdFrame_Click(object sender, EventArgs e)
        {
            ModCap.CaptureInformation.CaptureInfo.CaptureFrame();
        }
    }
}

1 个答案:

答案 0 :(得分:1)

修复以下代码:

private System.Windows.Forms.Button withEventsField_cmdFrame;
   // internal System.Windows.Forms.Button cmdFrame
    {
        get { return withEventsField_cmdFrame; }
        set
        {

尝试删除评论。