//调用API函数可以移除winform中的按钮
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int wndproc);
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
public const int WS_SYSMENU = 0x80000;
public const int WS_MINIMIZEBOX = 0x20000;
public const int WS_MAXIMIZEBOX = 0x10000;
public const int GWL_STYLE = -16;
private void NewFile_Load(object sender, EventArgs e)
{
SetWindowLong(this.Handle, GWL_STYLE, (~WS_MAXIMIZEBOX) &(~WS_MINIMIZEBOX) & GetWindowLong(this.Handle, GWL_STYLE));
// (~WS_SYSMENU) &
//(~WS_SYSMEMU)注释掉的是我想保留关闭按钮,不把他放在设置窗口方法中去!如果把它加进去的话那么三个按钮都被移除掉了!
这是我心学到的只是啦