[vtkusers] How to enable vtkButtonWidget's LeftButtonPressEvt event in .net
louiskoo
419655660 at qq.com
Mon Jul 8 02:16:59 EDT 2013
Below is my code:
vtkTexturedButtonRepresentation2D rep =
vtkTexturedButtonRepresentation2D.New();
rep.SetNumberOfStates(2);
rep.SetButtonTexture(0, imageData1);
rep.SetButtonTexture(1, imageData2);
rep.SetPlaceFactor(1);
double[] position = new double[3] { 1, 1, 1 };
IntPtr p0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double))
* 3);
Marshal.Copy(position, 0, p0, 3);
double[] orientation = new double[3] { 1, 1, 1 };
IntPtr p1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double))
* 3);
Marshal.Copy(orientation, 0, p1, 3);
vtkRenderWindow renderWindow = vtkRenderWindow.New();
vtkRenderWindowInteractor renderInteractor =
vtkRenderWindowInteractor.New();
renderInteractor.SetRenderWindow(renderWindow);
vtkButtonWidget buttonWidget = vtkButtonWidget.New();
//buttonWidget.ProcessEventsOn();
buttonWidget.SetInteractor(renderInteractor);
buttonWidget.SetRepresentation(rep);
//buttonWidget.AddObserver()
buttonWidget.SetEnabled(1);
renderWindow.Render();
vtkWidgetEventTranslator widgetEventTranslator =
buttonWidget.GetEventTranslator();
vtkEvent eventNew = vtkEvent.New();
//eventNew.AnyEvt += new
vtkObject.vtkObjectEventHandler(eventNew_AnyEvt);
widgetEventTranslator.SetTranslation(eventNew, 0);
renderWindow.Render();
renderInteractor.Initialize();
buttonWidget.On();
renderInteractor.Start();
First , below is invalid and I don't know why .
buttonWidget.LeftButtonPressEvt+=new
vtkObject.vtkObjectEventHandler(buttonWidget_LeftButtonPressEvt);
Anyone can give me some idea?
--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-enable-vtkButtonWidget-s-LeftButtonPressEvt-event-in-net-tp5721822.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list