C#窗体固定在桌面上

 

[DllImport("user32.dll", EntryPoint = "RemoveMenu")]
public static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags);
[DllImport(
"user32.dll", EntryPoint = "GetSystemMenu")]
public static extern IntPtr GetSystemMenu(IntPtr hwnd, int bRevert);
public const int SC_MOVE = 61456;
public const int MF_BYCOMMAND = 0;
public const int MF_DISABLED = 2;

public const int MF_GRAYED = 1;

private void button1_Click(object sender, EventArgs e)
{
    IntPtr hMenu
= GetSystemMenu(this.Handle, 0);
    RemoveMenu(hMenu, SC_MOVE, MF_BYCOMMAND
| MF_DISABLED | MF_GRAYED);
}

你可能感兴趣的:(C++,c,C#)