首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >鼠标拖动到具有InputSimulator的目标

鼠标拖动到具有InputSimulator的目标
EN

Stack Overflow用户
提问于 2016-12-15 00:17:49
回答 1查看 361关注 0票数 0

我需要拖动一个WPF元素并插入另一个WPF目标元素。在我的测试代码中,我一直在使用InputSimulator进行键盘交互。但是没有发现任何关于用InputSimulator鼠标拖动的东西。对此有什么看法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-15 14:35:31

您可以使用鼠标类中的本机编码ui方法。就像,

每个OP请求的编辑:

代码语言:javascript
复制
// Determine drop coordinates dynamically       
Point dropDestinationPoint = controlYouWanttoDropOn.GetClickablePoint();
// Add some buffer to avoid possible clicking over the edges - Optional
dropDestinationPoint.X += 5; 
dropDestinationPoint.Y += 5;    
Mouse.StartDragging(controlYouWantToDrag);
Mouse.StopDragging(controlYouWanttoDropOn, dropDestinationPoint);

您也可以尝试通过BoundingRectangle属性获得点数并使用它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41154427

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档