Ozz*_*zzy 3 c# desktop z-index
可以说我在C#中有一个普通的窗口.它没有边框样式,因此无法移动或调整大小等.我如何定位该窗口使其显示在与桌面或上面相同的级别?
像小部件或雨量计皮肤.有任何想法吗?
如果我理解你并且你想在桌面上绘图,基本上,这可能会有所帮助:http://www.neowin.net/forum/lofiversion/index.php/t293883.html
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr FindWindow(
[MarshalAs(UnmanagedType.LPTStr)] string lpClassName,
[MarshalAs(UnmanagedType.LPTStr)] string lpWindowName);
[DllImport("user32.dll")]
public static extern IntPtr SetParent(
IntPtr hWndChild, // handle to window
IntPtr hWndNewParent // new parent window
);
IntPtr hwndf = this.Handle;
IntPtr hwndParent = FindWindow("ProgMan", null);
SetParent(hwndf,hwndParent);
this.TopMost = false;
Run Code Online (Sandbox Code Playgroud)
这会将您的表单重新表现为桌面本身的子窗口.
在多次阅读代码后,我不确定为什么他们使用FindWindow()寻找"ProgMan"而不是使用
[DllImport("user32.dll")]
static extern IntPtr GetDesktopWindow();
Run Code Online (Sandbox Code Playgroud)
但到目前为止我自己都没试过.
| 归档时间: |
|
| 查看次数: |
3126 次 |
| 最近记录: |