如何以编程方式(假设我们已将其作为变量引用)将已显示的表单置于前台并将其集中在 C# WinForms 应用程序中?
最佳答案
您可以使用SetForegroundWindow
。这里的好例子:C# Force Form Focus .
[DllImport("User32")]
private static extern int SetForegroundWindow(IntPtr hwnd);
用法:
SetForegroundWindow(form.Handle);
关于c# - 如何将已经显示的表单置于最前面并使其聚焦?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6319568/