Sign in to follow this  
Lutz

C# WPF and Forms mouse wheel problem

Recommended Posts

Hey, I've written a C# application based on WPF. It's basically an editor that contains a control where D3D renders to. In order to make D3D render to that control inside the WPF application window, it was necessary to create a Windows Forms control (not a WPF control) inside the WPF window. I've hooked up the mouse event handlers (mouse up/down/move/wheel) to the control containing the Forms control (aka the "parent control") and everything works fine except the mouse wheel event that seems to be eaten in some place, but I cannot figure out where. The event is simply never fired. I tried hooking up the wheel event to the Forms control instead of the parent control, but that doesn't work either. Setting mouse capture on the parent control brings the wheel event back to life, but then the other mouse events are somehow cluncky (they fire irregularly). Has anyone experienced similar problems? Is there a way to trace down the mouse wheel message to find out where it is lost? Thanks! Lutz

Share this post


Link to post
Share on other sites
Have you managed to narrow this down to being caused by or related to Direct3D? As in, if you comment out whatever D3D code you have does everything else work fine?

I really can't see why D3D would be sucking up any input messages - it listens to state messages for the target window, but it's an output API so shouldn't care in the slightest for user input [smile]

Jack

Share this post


Link to post
Share on other sites
Hmm, I didn't try to eliminate the D3D code since I was expecting that some WPF/Forms interop problem is responsible for this, but it is probably a good idea. I'm using a commercial engine and I don't have a proper overview yet of the details happening inside. At runtime it only does rendering, but maybe in the init code it sets some callback handling the mouse wheel.

Thanks, Lutz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this