请帮助将C#代码转换为vb.net [英] Pls help in converting c# code to vb.net

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

问题描述

请帮助将此代码转换为vb.net

Pls help in converting this code to vb.net

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 TouchlessLib;
using System.Drawing.Imaging;

namespace Capture
{
    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, System.EventArgs e)
        {
            Bitmap c = _touch.CurrentCamera.GetCurrentImage();
            pictureBox1.BackgroundImage = c;
            button1.Enabled = false;
        }

        private void button2_Click(object sender, System.EventArgs e)
        {
            button1.Enabled = true;
        }

    }
}

推荐答案

尝试此在线转换网站
.NET(C#<-> VB.NET)的代码转换 [
Try this online Conversion website
Code Translation for .NET (C#<->VB.NET)[^]


Her是在VB和C#

Developer Fusion将C#转换为VB.NET [
Her is an excellent tool for converting between VB and C#

Developer Fusion Convert C# to VB.NET [^]

Hope this helps


尝试此链接

点击 [
try this link

Click[^]


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

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