C# Force Form Focus

前端 未结 8 1964
不思量自难忘°
不思量自难忘° 2020-12-02 14:46

So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the sc

8条回答
  •  囚心锁ツ
    2020-12-02 15:22

    You shouldn't need to import any win32 functions for this. If .Focus() isn't enough the form should also have a .BringToFront() method you can use. If that fails, you can set it's .TopMost property to true. You don't want to leave it true forever, so then call Application.DoEvents so the form can process that message and set it back to false.

提交回复
热议问题