Silverlight 用户控制鼠标移动
我正在尝试创建一个控件,允许从流网络摄像头捕获静态图像。我的想法是将相机流式传输到我已经运行的矩形控件中。我需要为用户提供指定他们想要捕获的流区域的能力。为此,我创建了一个非常简单的 UserControl,其网格具有 2x 列和行,并将 ShowGridLines 设置为 true。
我将其显示在与流式矩形相同的网格列/行中,并且可以在流的中心看到我的“十字准线”。我现在需要将 UserControl 的中心定位到鼠标光标坐标。
当我陷入困境时有人可以帮助我吗?
I am trying to create a control that allows capture of a still image from a streaming network cam. My idea is to stream the camera into a rectangle control, which I have functioning. I need to provide ability for user to specify area of the stream they want to capture. For this I have created a very simple UserControl with a grid having 2xcolumns and rows and setting ShowGridLines to true.
I show this in the same grid column/row as my streaming Rectangle and can see my "crosshairs" in the centre of my stream. I now need to position the centre of my UserControl to the mouse cursor co-ordinates.
Can anyone help as I'm struggling?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为
MouseLeftButtonUp
添加 EventTrigger,并在其中使用Pointposition = e.GetPosition(null);
。进行此操作后,您将获得鼠标位置,并可以使用UserControl
执行您需要的任何操作。Add EventTrigger for
MouseLeftButtonUp
and within it usePoint position = e.GetPosition(null);
. After this manipulation you'll have mouse position and can do whatever you need withUserControl
.