All, I am over half way through a MDI WinForm application and have started testing what we have so far on several different machines and I have found the following error on all machines (running Windows 7/Vista). The error is to do with the TaskBar and the visably active state of the application within it. This will be easier with images:
A. I hover over the Task Bar ready to launch.
B. I click on the application and it launches no problem and shows in the Task Bar - all good so far.
C. Wait for perhaps three seconds and the icon fades away to not being active, so that when I click on it, it launches another instance of my application instead of restoring the one I have just opened!? Once I click on the form and minimise and then restore the form this problem goes away!?
This is strange and I have no idea how to go about fixing it. This also manifests itself when using the .exe file to launch the application, where the task bar does not show at all until you click on the applications main form. I am truly stumped. If anyone has any idea about what could be happening here, it would be most appreciated? Thanks for your time.
Note. I have narrowed the problem down to the form being launched behind other open forms. I have used the relevent options this.TopLevel = true;
in the forms Shown
event etc. but nothing seems to work...
All,
This was solved by adding
this.Activate();
in the finally
block of the main form's (the MDI parent form's) Shown
event.
Thanks for your time and help.