当FormBorderStyle = System.Windows.Forms.FormBorderStyle.None时,应用程序在任务栏中无法弹出右键;下面通过调用API调出右键菜单:
[DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
[DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
int WS_SYSMENU = 0x00080000; // 系统菜单
int WS_MINIMIZEBOX = 0x20000; // 最大最小化按钮
int windowLong = GetWindowLong(new HandleRef(this, this.Handle), -16);
SetWindowLong(new HandleRef(this, this.Handle), -16, windowLong | WS_MINIMIZEBOX | WS_SYSMENU);
无标题栏窗体按住窗体实现移动请参考:http://www.cnblogs.com/ssda/archive/2009/06/10/1500881.html