Hi all,
So here is my situation:
2 classes
1st class is a windows form created in VS2008. It has a picture box on it which i want to update with images.
2nd class is a custom class called 'camera' which uses the AForge.Net framework to grab images from my webcam. The important part is that there is an event handler that fires everytime a new frame is got from the webcam and creates a bitmap.
So... I need some advice on the best way of updating the picturebox in the form class with the latest frame in the camera class..
At the moment I have a set method in the form class like so...
public static void setPB(Bitmap image)
{
var form = Forms.ActiveForm as Form1;
form.PictureBox.Image = image
}
this method is then called in the newframe event handler within the camera class.
This code works fine however I would like to know if this is the best way to attack the problem?
The other way I thought of doing it was when i create an object of the camera class, to pass my form as a parameter so that I can set the picturebox image from within the camera class itself.
Please note: i only have 1 thread at the moment.
Thanks in advance, much appreciated.
Tom