C # Windows Form startup is always kept to a minimum
I have developed a C # Windows Form. Windows Form works fine at first. However, once starting a Windows Form is always minimized and I have no idea. I have WindowState
Normal
not checked Minimized
. How can I fix this, thanks!
Edit:
I comment out each block of code to narrow down my search to find the problem. And I found that I was using Drive Detector in my MainForm . When this instance has been created, the invocation window form must be passed as a parameter to the constructor. Otherwise it Drive Detector
will create a hidden shape. However, MainForm will be kept to a minimum.
The code below will NOT create a hidden form.
driveDetector = new DriveDetector(this);
The code below will create a hidden form, it will interfere with calling Windows Form.
driveDetector = new DriveDetector();
source to share
I comment out each block of code to narrow down my search to find the problem. And I found that I was using Drive Detector in my MainForm . When this instance has been created, the invocation window form must be passed as a parameter to the constructor. Otherwise it Drive Detector
will create a hidden shape. However, MainForm will be kept to a minimum.
The code below will NOT create a hidden form.
driveDetector = new DriveDetector(this);
The code below will create a hidden form, it will interfere with calling Windows Form.
driveDetector = new DriveDetector();
source to share