你會如何在桌面圖標後面放置WinForms表單,但在壁紙前面?爲了使桌面成爲父窗體,我使用:如何在桌面圖標後面放置表單?
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
IntPtr desktopHandle = (IntPtr)FindWindow("Progman", null);
WallForm wallWindow = new WallForm();//WinForms Form
...
private void SwitchParent()
{
wallWindow.Show();
SetParent(wallWindow.Handle, desktopHandle);
//wallWindow.SendToBack();
}
這可以工作,但它將窗體放在桌面圖標的前面。如果我在窗體上調用SendToBack,它會消失,大概在壁紙後面。我怎樣才能讓表單處於圖標和桌面背景之間?
您可以將窗口保存爲桌面背景設置的位圖,但我假設您需要一個工作應用程序,在那種情況下它是不可能的。 – 2013-02-15 02:40:27
這是什麼用例?也許有更好的方法來實現相同的目標。 – 2013-02-15 05:52:30