Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Windows Form start up always minimized

Tags:

c#

winforms

I have developed a C# Windows Form. At first, the Windows Form works fine. However, one day the Windows Form starts up always minimized and I have no idea. I checked the WindowState is Normal not Minimized. How Can I fix it, Thanks!


Edit:

I comment each code block to narrow the scope to locate the problem point. And I found that I used a Drive Detector in my MainForm. When that instance was created, the call Window form must be passed as a parameter to the constructor. Otherwise, the Drive Detector will create a hidden form. However, the MainForm will be minimized.

The below code will NOT create a hidden form.

driveDetector = new DriveDetector(this);

The below code will create a hidden form, it will interfere the call Windows Form.

driveDetector = new DriveDetector();
like image 761
Andy Avatar asked Dec 02 '25 21:12

Andy


1 Answers

try to add this code in form load event and test

this.WindowState = FormWindowState.Normal;
like image 50
Ahmed Mohsen Avatar answered Dec 04 '25 12:12

Ahmed Mohsen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!