将一个WPF形式在桌面 [英] Drag a WPF Form around the desktop

查看:180
本文介绍了将一个WPF形式在桌面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个C#WPF的形​​式,我可以通过点击和移动鼠标拖动它在屏幕上。形式特征包括是完全透明的,只包含一个图像。这是说的窗口样式是没有的,它不显示在任务栏。所以基本上所有的应用程序正在运行时,你可以看到的是一个小图像 - 和理想我希望能够拖动它周围的桌面上,如果我点击并按住鼠标左键移动约

i am trying to make a c# WPF form where i can drag it around the screen by clicking on it and moving with the mouse. the forms characteristics include being completely transparent and containing only one image. This being said the window style is none and it is not displayed in the taskbar. So essentially all you can see when the app is running is a little image - and ideally i want to be able to drag it around the desktop if i click and hold the left mouse button and move it about.

有谁知道一个简单的方法,我可以做到这一点还是有我在功能上忽略了构建?

Does anyone know a simple way i can accomplish this or have i overlooked a build in function?

感谢。

推荐答案

您可以使用Window.DragMove方法鼠标按下窗口的事件。

You can use the Window.DragMove method in the mouse down event of the window.

这篇关于将一个WPF形式在桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆