c#始终在顶部例外
我用了这个密码c#始终在顶部例外,c#,fullscreen,always-on-top,C#,Fullscreen,Always On Top,我用了这个密码 namespace WindowsFormsApplication52 { public partial class Form1 : Form { static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2); static readonly IntPtr HWND_TOP = new IntPtr(0
namespace WindowsFormsApplication52
{
public partial class Form1 : Form
{
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
static readonly IntPtr HWND_TOP = new IntPtr(0);
static readonly IntPtr HWND_BOTTOM = new IntPtr(1);
const UInt32 SWP_NOSIZE = 0x0001;
const UInt32 SWP_NOMOVE = 0x0002;
const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
}
}
但有些应用程序仍然处于领先地位。我离开了任务管理器,但有时我想重新开始。我无法运行。我怎么修理它
一些最顶端的窗口比最顶端的窗口更顶端,因为它们只是到达顶端:)@AlexeiLevenkov creative solutions:)为什么要使用该代码??只需设置表单的最高属性,而不是重新发明轮子<代码>this.topmest=true代码>它不工作。我还是试着关上它