private void button1_Click_1(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex < 0)
            {
                MessageBox.Show(this, "Wybierz urzadzenie z dostepnej listy");
                return;
            }
            cam = (WebCam)listBox1.SelectedItem;

            cam.DisplayWebCam(pictureBox1, listBox1.SelectedIndex);
        }
Beispiel #2
0
        public static void LoadAllDevices(ListBox lstDevices)
        {
            String devicename    = "".PadRight(100);
            String deviceversion = "".PadRight(100);

            lstDevices.Items.Clear();
            for (int i = 0; i <= 10; i++)
            {
                bool isDeviceReady = capGetDriverDescriptionA(i, ref devicename, 100, ref deviceversion, 100);
                if (!isDeviceReady)
                {
                    continue;
                }
                {
                    WebCam d = new WebCam(devicename, deviceversion);
                    lstDevices.Items.Add(d);
                }
            }
        }
 private void Form1_Load_1(object sender, EventArgs e)
 {
     WebCam.LoadAllDevices(listBox1);
 }