I did it, but too much exceptions occur Mainform.cs
Subform subform = new Subform();
subform.GetCapture += new Subform.GetCapture(SetSubformImage);
subform.Show();
//Set subform image to a pictureBox
void SetSubformImage(Image img) {
this.pic.Image = img;
}
Subform.cs
public delegate void CaptureHandle(Image img);
public event CaptureHandle GetCapture;
public Image ImgSubForm {
set{
if(GetCapture != null)
GetCapture(value);
}
}
//...Function GetFormImage return current form image
//Event form activated
private void Subform_Activated(object sender, EvenAgrs e) {
timer.Enable = true;
//With timer.Tick += { ImgSubForm = GetFormImage(); }
}
The code above can get image and sent to main form, however RAM increase up 2GB within 1 minute. I don't understand why, without i turned timer off but RAM not decrease till close subform. Why or any solution ?