/// <summary> /// Performs the initialization of the HDisplayControl /// during loading to the memory. /// </summary> private void HDisplayControl_Load(object sender, EventArgs e) { hWndControl = new HWndCtrl(viewPort); // Initialization graphic window size windowExtents = new Rectangle(0, 0, this.viewPort.WindowSize.Width, this.viewPort.WindowSize.Height); imageWidth = imageHeight = 0; displayZoomValue = 100; zoomCenter = new Point(windowExtents.Width / 2, windowExtents.Height / 2); if (MoveOnPressedMouseButton) hWndControl.setViewState(HWndCtrl.MODE_VIEW_MOVE); else hWndControl.setViewState(HWndCtrl.MODE_VIEW_NONE); // add event handler after zooming the image hWndControl.OnImageZoomed += new OnIconicObjectZoomedHandler( this.hWndControl_IconicObjectZoomed); hWndControl.OnImageMoved += new OnIconicObjectMovedHandler( this.hWndControl_IconicObjectMoved); // setup ROIController roiController = new ROIController(); hWndControl.useROIController(roiController); // handle the changes of regions roiController.NotifyRCObserver = null; roiController.NotifyRCObserver = new IconicDelegate(UpdateViewData); hWndControl.clearList(); //--------- // set the sign of the draw region to the value "Add Region" roiController.setROISign(ROIController.MODE_ROI_POS); this.ShowROI = true; }
/// <summary> /// Registers an instance of an ROIController with this window /// controller (and vice versa). /// </summary> /// <param name="rC"> /// Controller that manages interactive ROIs for the HALCON window /// </param> public void useROIController(ROIController rC) { roiManager = rC; rC.setViewController(this); }