English 中文(简体)
WPF - 模拟在被解冻后举行的模拟模拟模拟活动
原标题:WPF - simulate mouse events on off-screen rendered Grid

I m 提供多元素(布顿、文字箱......)的WPF网网,然后作为直线3D现场3D表面的图像。 在用户互动方面,我从2D的2D型 mo曲线进入3D场现场,发现与吉表交点。 因此,我知道用户点击了WPF网的电网,但从那里发现Im st:

我怎么能够模拟关于世界森林组成部分的模拟活动,而实际上没有在开放的窗口中显示,而是在幕后进行?

最近,我正在研究UIAutomation和RaiseEvent,但被用来向个别分子,而不是整个直观树发送活动。 手工挖掘树木和寻找 cur子位置的元素是一种选择,但我没有找到准确做到这一点的途径。 视觉疗法。 手工试验是一个良好的开端,但不是发现文本Box,而是发现文本BoxView,而不是清单Box,而是发现边界。

EDIT:返回Hit-ReultBehavior。 继续执行《希特试验》的号召,让我走到某个特定点的所有部分。 现在,我可以向所有这些要素发出模拟事件,但摩加堡目标的价值是真实的。 因此,我不得不制造一种似乎是不可能的习俗。

PointHitTestParameters p = new PointHitTestParameters(new Point(
    ((Vector2)hit).X * sourceElement.ActualWidth, 
    (1 - ((Vector2)hit).Y) * sourceElement.ActualHeight));
VisualTreeHelper.HitTest(sourceElement,
     new HitTestFilterCallback(delegate(DependencyObject o)
     {
         return HitTestFilterBehavior.Continue;
     }),
     new HitTestResultCallback(delegate(HitTestResult r)
     {
         UIElement el = r.VisualHit as UIElement;
         if (el != null)
         {
             MouseButtonEventArgs e = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left);
             if (leftMouseDown) e.RoutedEvent = Mouse.MouseDownEvent;
             else e.RoutedEvent = Mouse.MouseUpEvent;
             el.RaiseEvent(e);
         }
         return HitTestResultBehavior.Continue;
     }), p);
问题回答

你们也许可以通过邮政Message(如WM_MOUSEMOVE)向WPF的窗口HWND发出窗口信息。 我认为,这些电文将由世界森林论坛阅读,如来自用户,则予以执行。





相关问题
WPF convert 2d mouse click into 3d space

I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

How do WPF Markup Extensions raise compile errors?

Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签