I just wanted to use a simple PDF viewer for a company application. I decided on AxAcroPDF for this. It works well enough.
The problem I can't seem to fix is that the form will sometimes, actually a majority of the time, load in the background. This is particularly annoying if I'm just debugging from code, but it also happens when the application is launched from published locations.
I've tried:
BringToFront()
Activate()
Focus()
This seems to work:
TopMost = True
But it it doesn't actually focus the form itself. I'm not sure what it's focusing, maybe the AxAcroPDF control? More importantly, I don't want the application constantly being on top.
Any ideas how to address this issue?
## Update ##
I managed to get it somewhat working, but it's hacky.
1.) I create a timer and set it to 600ms/enabled.
2.) At the end of Form_Load, I set:
TopMost = True
3.) Timer tick even handler:
Private Sub tTimerTest_Tick(sender As Object, e As EventArgs) Handles tTimerTest.Tick
TopMost = False
Activate()
tTimerTest.Enabled = False
End Sub
This "works" I guess, but I doubt it's going to be consistent across all computers, as some will load controls at different speeds, in particular, the PDF viewer.
This still isn't a proper/consistent fix. :\