Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3331756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:37:00+00:00 2026-05-17T23:37:00+00:00

My Code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;

  • 0

My Code:

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;

namespace WebCam2
{
    public partial class Form1 : Form
    {
        TouchlessMgr ngr = new TouchlessMgr();
        Bitmap _overlay;
        public Form1()
        {
            InitializeComponent();
            foreach (Camera c in ngr.Cameras)
            {
                listBox1.Items.Add(c);
                listBox1.SelectedValueChanged += new EventHandler(listBox1_SelectedValueChanged);

            }
        }

        void listBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            ngr.CurrentCamera = (Camera) listBox1.SelectedItem;
            ngr.CurrentCamera.OnImageCaptured += c_OnImageCaptured;
        }

        void c_OnImageCaptured(object sender, CameraEventArgs e)
        {
            pictureBox1.Image = ngr.CurrentCamera.GetCurrentImage();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {


        }

        public EventHandler<CameraEventArgs> cam_OnImageCaptured { get; set; }

        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            List <Graphics> list = new List <Graphics>();
            ngr.RefreshCameraList();
            Graphics g = Graphics.FromImage(pictureBox1.Image);
            Brush redBrush = new SolidBrush(Color.Red);
            Pen pen = new Pen(redBrush,3);
            for ( int i = 0; i < pictureBox1.Width; i = (pictureBox1.Width/3)+i)
            {
                for (int y = 0; y < pictureBox1.Height; y = (pictureBox1.Height / 3) + y)
                {
                    g.DrawRectangle(pen, i, y, pictureBox1.Width / 3, pictureBox1.Height / 3);
                }
            }
            g.Dispose();


        }

    }
}

This code works only sometimes not everytime, i dont know whats wrong with the code.
I also want to split the image into a 3×3 matrix but i do not know how.

Please help!

Output(1st Time no frame,2nd time right):

ImageLink:

http://www.imagebanana.com/view/4j58i05z/Unbenannt2.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:37:01+00:00Added an answer on May 17, 2026 at 11:37 pm

    Add pictureBox1.Invalidate(); after g.Dispose

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here's the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using
i have the following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
i have the following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
Any help? Here's my code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
I have the following code: using System; using System.Linq; using System.Linq.Expressions; public class Program
I have this code :- using (System.Security.Cryptography.SHA256 sha2 = new System.Security.Cryptography.SHA256Managed()) { .. }
The following code using System.Threading; class Test { volatile int counter = 0; public
I get an error when I compile this code: using System; public struct Vector2
Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) {
Using the obsolete System.Web.Mail sending email works fine, here's the code snippet: Public Shared

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.