调用Windows API中的SetWindowPos方法可以实现。
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
class Program
{
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SetWindowPos(
IntPtr hWnd,
IntPtr hWndInsertAfter,
int x,
int y,
int cx,
int cy,

通过调用Windows API的SetWindowPos方法,可以设置C#控制台应用程序窗口为TopMost状态,使其始终保持在其他窗口之上。
最低0.47元/天 解锁文章
1952

被折叠的 条评论
为什么被折叠?



