当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

相关文章:

  • 2022-12-23
  • 2022-02-23
  • 2022-01-20
  • 2021-12-14
  • 2021-04-24
  • 2021-07-13
  • 2022-12-23
  • 2021-11-25
猜你喜欢
  • 2021-08-25
  • 2022-12-23
  • 2021-11-20
  • 2021-06-26
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案