おれのフォーカス

  • タグ:
  • タグはありません
Control control = ActiveControl;

axAcroPDF1.LoadFile(@"..\..\test.pdf");
if (control == null) return;

Thread thread = new Thread(new ThreadStart(delegate() {
    while (true) {
        Thread.Sleep(300);
        bool focused = true;
        Invoke((MethodInvoker)delegate() {
            focused = control.Focused;
        });
        if (!focused)
        {
            Invoke((MethodInvoker)delegate() {
                control.Focus();
            });
            break;
        }
    }
}));
thread.Start();