让不置顶的窗体不会被最小化

 [DllImport("user32.dll", EntryPoint = "SetParent")]
        
public static extern int SetParent(int hWndChild, int hWndNewParent);

        [DllImport(
"user32.dll", EntryPoint = "FindWindow")]
        
public static extern int FindWindow(string lpClassName, string lpWindowName);

        
public Form1()
        {
            InitializeComponent();
            SetParent(
this.Handle.ToInt32(), FindWindow("Progman""Program Manager"));
         
        }

 

这样做的目的在于将窗体的父窗口设为桌面,那么就不会被最小化了

原文地址:https://www.cnblogs.com/myjece/p/1258130.html