I have a screenshot application where a user can pass command line arguments, and based on those arguments will determine the behaviour of the form.
I am trying to take a screenshot after the form has loaded, however I have the functionality to do this after InitializeComponent();. Like so-
if (counts > 0)
{
generateScreenshotButton_Click(null, null);
button2_Click(null, null);
}
My problem being these functions are firing before the form has loaded. Therefore the screen shot is blank. How can I resolve this?
Add
Loadevent in yourForm.csfile.There is a difference between
InitializeComponentandForm Load. See What does InitializeComponent() do, and how does it work in WPF? It is for WPF but is same in Windows Forms.Try this code:
Hope that I helped you.