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

  • SEARCH
  • Home
  • 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 7747953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:39:34+00:00 2026-06-01T10:39:34+00:00

Having decided to try AForge for video and imaging stuff, I tried to implement

  • 0

Having decided to try AForge for video and imaging stuff, I tried to implement this simple demo:

private void Main_Load(object sender, EventArgs e)
{
        // enumerate video devices
        FilterInfoCollection videoDevices = new FilterInfoCollection(
                        FilterCategory.VideoInputDevice);
        // create video source
        VideoCaptureDevice videoSource = new VideoCaptureDevice(
                        videoDevices[0].MonikerString);
        // set NewFrame event handler
        videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
        // start the video source
        videoSource.Start();
}

private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
        this.pictureBox1.Image = eventArgs.Frame;
}

The problem is that I always get an ArgumentException, though doesn’t always happen right away. It pops up on Application.Run(new Main());, but the top of the stacktrace looks like this:

  • at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size()
  • at System.Windows.Forms.PictureBox.ImageRectangleFromSizeMode(PictureBoxSizeMode mode)
  • at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)

Not sure if this is relevant, but the ParamName attribute of the exception is null. I’ve tried wrapping the image assignment in a try…catch block, but this didn’t help. I’ve also checked to make sure that the image is not null before assignment. I’ve also checked for non-null, but 0x0 sized images.

What have I done wrong? Can anyone suggest a workaround?

  • 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-06-01T10:39:36+00:00Added an answer on June 1, 2026 at 10:39 am

    I think the problem is that you do not make a copy
    of the passed bitmap (frame) in your event handler.

    The AForge documentation says:

    Since video source may have multiple clients, each client is responsible
    for making a copy (cloning) of the passed video frame, because the video source
    disposes its own original copy after notifying of clients.

    So, if you directly assign the frame to the picture box
    the bitmap could be disposed by the AForge framework while the PictureBox
    is trying to draw the bitmap.

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

Sidebar

Related Questions

I am attemtping to solve an issue I am having and decided to try
So I decided to try out PostgreSQL instead of MySQL but I am having
I decided to try out JavaScript genius John Resig's simple JavaScript inheritance as detailed
I recently decided to give matplotlib.pyplot a try, while having used gnuplot for scientific
I am currently working on a ASP.NET AJAX application. Having decided to not use
I'm having a little trouble as I decide how to structure my projects. This
Having the following class: public class SomeClass { private readonly int[] _someThings; public SomeClass()
I recently decided to port my indexing engine from sphinx to solr. Having used
My boss decided recently to try out an outsourcing group for increased capacity as
I finally decided to try out Vim , as I am getting increasingly frustrated

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.