<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Re: [vtkusers] MouseWheel and .NET</TITLE>
</HEAD>
<BODY>
<DIV id=idOWAReplyText87474 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>I&nbsp;verified that the 
focused .NET component consumes the WM_MOUSEWHEEL message, and the VTK graphics 
window would not receive it. I worked around this by simply overriding the 
following .NET method:<FONT size=2>
<P>OnMouseWheel(</FONT><FONT color=#008080 size=2>MouseEventArgs</FONT><FONT 
size=2> e)</FONT></P>
<P>Using the value of e.Delta I&nbsp;directed this method to call the 
appropriate MouseWheel method of the VTK&nbsp;interactor as follows:</P><FONT 
size=2><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (forward) {</P>
<P></FONT><FONT color=#0000ff size=2>this</FONT><FONT 
size=2>-&gt;trackballCam-&gt;OnMouseWheelForward();</P>
<P>} </FONT><FONT color=#0000ff size=2>else </FONT><FONT size=2>{</P>
<P></FONT><FONT color=#0000ff size=2>this</FONT><FONT 
size=2>-&gt;trackballCam-&gt;OnMouseWheelBackward();</P>
<P>}</P></FONT></FONT></FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Mathieu Malaterre 
[mailto:mathieu.malaterre@kitware.com]<BR><B>Sent:</B> Wed 3/8/2006 5:11 
PM<BR><B>To:</B> David Montgomery<BR><B>Cc:</B> 
vtkusers@vtk.org<BR><B>Subject:</B> Re: [vtkusers] MouseWheel and 
.NET<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>David Montgomery wrote:<BR>&gt; In VTK 5.0.0 mouse wheel input 
zooms the trackball interactor as<BR>&gt; expected when I use a stand alone 
win32 window. When I parent the VTK<BR>&gt; graphics window to a .NET Windows 
Forms component (such as a panel), the<BR>&gt; mouse wheel input apparently gets 
consumed by a .NET component. Does<BR>&gt; anyone know a work-around or setting 
I should use to get the mouse wheel<BR>&gt; input to the VTK window?<BR><BR>Be 
sure to propagate the events down to VTK. Have a look at:<BR><BR>&nbsp;&nbsp; 
VTK/Examples/GUI/Win32/SampleMFC/vtkMFCRenderView.cpp<BR><BR>...<BR>// Define 
our own event handler here<BR>LRESULT vtkMFCRenderView::WindowProc(UINT message, 
WPARAM wParam, LPARAM<BR>lParam)<BR>{<BR>&nbsp;&nbsp; switch 
(message)<BR>&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp; //case 
WM_PAINT:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_LBUTTONDOWN:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_LBUTTONUP:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_MBUTTONDOWN:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_MBUTTONUP:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_RBUTTONDOWN:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_RBUTTONUP:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_MOUSEMOVE:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_MOUSEWHEEL:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_CHAR:<BR>&nbsp;&nbsp;&nbsp;&nbsp; case 
WM_TIMER:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(this-&gt;Interactor-&gt;GetInitialized())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
vtkHandleMessage2(this-&gt;m_hWnd, message, wParam, 
lParam,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this-&gt;Interactor);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp; return vtkMFCView::WindowProc(message, wParam, 
lParam);<BR>}<BR>...<BR><BR>HTH<BR>Mathieu<BR></FONT></P></DIV>

</BODY>
</HTML>