设置窗口显示最前端

[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags);

private void MainForm_Load(object sender, EventArgs e)
{
SetWindowPos(this.Handle, -1, 0, 0, 0, 0, 1 | 2);

}

猜你喜欢

转载自www.cnblogs.com/wenlong2019/p/10426301.html