请问如何将一个控件的父窗口设为桌面
在vb.net中可以用下面的代码将一个控件设置为另一个控件的子控件
PictureBox1.Parent = PictureBox2.Parent
但是如果是要将其设置为桌面窗口的子控件应该桌面做呢?
PictureBox1.Parent =???
[最优解释]
[DllImport("user32.dll")]
public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent);
[其他解释]
这个API我也试过了 没反应
Private Declare Function GetDesktopWindow Lib "user32.dll" () As IntPtr
Private Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Int32
Dim hdesk As IntPtr = GetDesktopWindow
Dim ret As Int32 = SetParent(PictureBox1.Handle, hdesk)