[vtkusers] Change default mouse buttons
mirko heuegger
mheuegger at gmail.com
Thu May 23 08:02:43 EDT 2013
Hello!
I attached a working sample (Form1.cs, and at least on my computer ;-) )
for changing the default mouse buttons.
The trick is to get the current vtkInteractorStyle from
RenderWindow.GetInteractor().GetInteractorStyle()).GetCurrentStyle().
hth
mirko
On Thu, May 23, 2013 at 10:41 AM, Max <smapersmaper at gmail.com> wrote:
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Windows.Forms;
> using Kitware.VTK;
>
> namespace SmallEventsExample
> {
> public partial class Form1 : Form
> {
> public Form1()
> {
> InitializeComponent();
> }
>
> private void renderWindowControl1_Load(object sender, EventArgs e)
> {
> vtkCylinderSource cylinder = new vtkCylinderSource();
> cylinder.SetResolution(66);
> cylinder.SetRadius(2);
> cylinder.SetHeight(30);
> cylinder.Update();
>
> vtkPolyDataMapper mapper2 = vtkPolyDataMapper.New();
> mapper2.SetInputConnection(cylinder.GetOutputPort());
>
> vtkActor actor2 = vtkActor.New();
> actor2.SetMapper(mapper2);
>
> vtkRenderWindow renderWindow =
> renderWindowControl1.RenderWindow;
>
> vtkRenderer renderer =
> renderWindow.GetRenderers().GetFirstRenderer();
>
> vtkRenderWindowInteractor inter = renderWindow.GetInteractor();
>
> //renderWindow.SetInteractor(inter);
>
> interactorStyle =
> vtkInteractorStyle.New();//inter.GetInteractorStyle();
> inter.SetInteractorStyle(interactorStyle);
> interactorStyle.RightButtonPressEvt += new
> vtkObject.vtkObjectEventHandler(rightButtonPressVtkEvt);
> interactorStyle.RightButtonReleaseEvt += new
> vtkObject.vtkObjectEventHandler(rightButtonReleaseVtkEvt);
>
> interactorStyle.SetInteractor(inter);
>
> renderer.AddActor(actor2);
> renderer.ResetCamera();
> renderWindow.Render();
> }
>
> vtkInteractorStyle interactorStyle;
>
> void rightButtonPressVtkEvt(vtkObject sender, vtkObjectEventArgs e)
> {
> interactorStyle.StartRotate();
>
>
>
> }
>
> void rightButtonReleaseVtkEvt(vtkObject sender, vtkObjectEventArgs
> e)
> {
> interactorStyle.EndRotate();
> }
>
> }
> }
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Change-default-mouse-buttons-tp5720853p5720903.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
--
Real programmers don't document; if it was
hard to write, it should be hard to understand.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130523/7dc9f6e0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Form1.cs
Type: application/octet-stream
Size: 2061 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130523/7dc9f6e0/attachment.obj>
More information about the vtkusers
mailing list