I did a lot of searching and didn't find a solution. Basically after you call the LoadFile method on the control it loads the PDF asynchronously and once the PDF is loaded it will steal the focus. What you need to do is to spawn a new thread, wait half a second to give the ActiveX control a bit of time to load the file, then call the focus method on the appropriate control again.
private void LoadPDF(string path) {
axPDF.LoadFile(path);
Thread t = new Thread(new ThreadStart(Refocus));
t.Start();
jobsList.Focus();
}
private delegate void RefocusDelegate();
private void RefocusMethod()
{
jobsList.Focus();
}
private void Refocus()
{
Thread.Sleep(500);
this.BeginInvoke(new RefocusDelegate(RefocusMethod));
}
1 comment:
I had this same problem and searched and searched. This is the only article I could find on this problem. Thank you for finding a solution to this very annoying problem.
Post a Comment