C# 如何使自己的程式在“顯示桌面”時不最小化
阿新 • • 發佈:2019-02-16
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WS { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [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); private void Form1_Load(objectsender, EventArgs e) { SetParent(this.Handle.ToInt32(), FindWindow("Progman", "Program Manager")); } } }
如果要在windows 7 中實現該效果,需要在系統個性化設定中將主題改為“windows 7 Basic”具體原因未知...