Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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;
        }

    }
}
Posted
Comments
Sandeep Mewara 30-Apr-11 6:01am    
What help? You tried anything? Stuck somewhere?

Try this online Conversion website
Code Translation for .NET (C#<->VB.NET)[^]
 
Share this answer
 
Comments
carl_sti 30-Apr-11 6:33am    
tnx a lot RaviRanjankr for the link...it helps
RaviRanjanKr 30-Apr-11 14:12pm    
I Glad it helped you :)
Her is an excellent tool for converting between VB and C#

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

Hope this helps
 
Share this answer
 
try this link

Click[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900