请帮助转换此ff.将C#编码为VB [英] Plz help in converting this ff. code c# to vb

查看:157
本文介绍了请帮助转换此ff.将C#编码为VB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码段用于从Touchless库提供的成像设备捕获图像.请帮我转换这个ff.从 c#到vb 的代码...此代码来自 http://touchless.codeplex.com/releases/view/17986 示例...但是我需要在vb版本中使用......在此先感谢抱歉英语不好

This code snippet is use to capture image from imaging device provided by Touchless library. Plz help me in converting this ff. code from c# to vb...this code is from http://touchless.codeplex.com/releases/view/17986 sample... but i need it in vb version... thanks in advance sorry for bad English

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TouchlessLib;
using System.Drawing.Imaging;

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

        TouchlessMgr _touch = new TouchlessMgr();
        Bitmap _overlay;

        private void Form1_Load(object sender, EventArgs e)
        {
            foreach (Camera c in _touch.Cameras)
            {
                if (c != null)
                {
                    _touch.CurrentCamera = c;
                    c.OnImageCaptured += new EventHandler<CameraEventArgs>(c_OnImageCaptured);
                    _overlay = new Bitmap(c.CaptureWidth, c.CaptureHeight, PixelFormat.Format24bppRgb);
                    _overlay.MakeTransparent();
                    break;
                }
            }

            pictureBox1.Paint += new PaintEventHandler(pictureBox1_Paint);

        }

        void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            lock (this)
            {
                if (_b != null)
                {
                    e.Graphics.DrawImageUnscaledAndClipped(_b, pictureBox1.ClientRectangle);
                    e.Graphics.DrawImageUnscaledAndClipped(_overlay, pictureBox1.ClientRectangle);
                }
            }
        }

        Bitmap _b;

        void c_OnImageCaptured(object sender, CameraEventArgs e)
        {
            if (button1.Enabled)
            {
                _b = e.Image;
                pictureBox1.Invalidate();
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Bitmap c = _touch.CurrentCamera.GetCurrentImage();
            pictureBox2.BackgroundImage = c;
            //button1.Enabled = false;
        }

       
    }
}


您可以将库下载到此链接>> http://touchless.codeplex.com/releases/view/17986 [


you can download the library to this link >> http://touchless.codeplex.com/releases/view/17986[^]

推荐答案

尝试一下 http://www.developerfusion.com/tools/convert/vb-to-csharp/ [ ^ ]


我在引发事件时遇到了问题...在vb中与此等效的代码是什么.

i got problem in raising event...what is equivalent code to this in vb..

c.OnImageCaptured += new EventHandler<CameraEventArgs>(c_OnImageCaptured);




调用此方法...




calling this method...

void c_OnImageCaptured(object sender, CameraEventArgs e)
        {
            if (button1.Enabled)
            {
                _b = e.Image;
                pictureBox1.Invalidate();
            }
        }


这篇关于请帮助转换此ff.将C#编码为VB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆