[vtkusers] MouseWheel and .NET

Xiaofeng Zhao xf10036 at hotmail.com
Wed Mar 8 23:48:37 EST 2006


> David Montgomery wrote:
>> In VTK 5.0.0 mouse wheel input zooms the trackball interactor as expected 
>> when I use a stand alone win32 window. When I parent the VTK graphics 
>> window to a .NET Windows Forms component (such as a panel), the mouse 
>> wheel input apparently gets consumed by a .NET component. Does anyone 
>> know a work-around or setting I should use to get the mouse wheel input 
>> to the VTK window?
>

What you can do is in the .NET project, add a new .NET control class.  In 
the control class, override WndProc, in a way similar to (I don't have the 
exact code at hand right now):

virtual void WindowProc(ref Message m)
{
   switch (message)
     {
     //case WM_PAINT:
     case WM_LBUTTONDOWN:
     case WM_LBUTTONUP:
     case WM_MBUTTONDOWN:
     case WM_MBUTTONUP:
     case WM_RBUTTONDOWN:
     case WM_RBUTTONUP:
     case WM_MOUSEMOVE:
     case WM_MOUSEWHEEL:
     case WM_CHAR:
     case WM_TIMER:
       if (this->Interactor->GetInitialized())
         {
         return vtkHandleMessage2((HWND)Handle->ToInt32(), (UINT)m.Msg, ...,
                                  this->Interactor);
         }
       break;
     }
   base(m);
}

where "Interactor" is a point to a vtkWin32RenderWindowInteractor object. 
Of course, you need to do it in a C++ project.

XZ
http://www.xzing.org 



More information about the vtkusers mailing list