/// <summary> /// Return the crosshairs to middle position /// </summary> public override void ResetCrosshairs(Control parentCtl) { CrossHairsControl crossHairsCtl = GetCrossHairsCtl(parentCtl); if (crossHairsCtl != null) { crossHairsCtl.ResetCrossHairs(); } }
public override void CrossHairs(Control parentWindow, bool showCrossHairs) { CrossHairsControl crossHairsCtl = GetCrossHairsCtl(parentWindow); if (crossHairsCtl != null) { crossHairsCtl.ShowCrossHairs = showCrossHairs; crossHairsCtl.ResetCrossHairs(); } }
//CrossHairsControl _crossHairsCtl = null; /// <summary> /// Get the Marker offset /// </summary> /// <param name="parentCtl"></param> public override PointF MarkOffset(Control parentCtl) { CrossHairsControl crossHairsCtl = GetCrossHairsCtl(parentCtl); if (crossHairsCtl == null) { return(PointF.Empty); } return(crossHairsCtl.MarkerOffset); }
public override void RegisterCameraWindow(Control parentWindow) { // return; lock (LockCogDisplay) { CogDisplay cogDisplay = new Cognex.VisionPro.Display.CogDisplay(); ((System.ComponentModel.ISupportInitialize)(cogDisplay)).BeginInit(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CameraBaseCtl)); // // cogDisplay // cogDisplay.Location = new System.Drawing.Point(0, 0); cogDisplay.MouseWheelMode = Cognex.VisionPro.Display.CogDisplayMouseWheelModeConstants.Zoom1; cogDisplay.MouseWheelSensitivity = 1D; cogDisplay.Name = COGNEXWINDOWNAME; cogDisplay.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("cogDisplay.OcxState"))); cogDisplay.Size = parentWindow.Size; cogDisplay.Anchor = parentWindow.Anchor; cogDisplay.TabIndex = 1; cogDisplay.ClientSizeChanged += new EventHandler(CogDisplay_ClientSizeChanged); cogDisplay.Changed += new CogChangedEventHandler(CogDisplay_Changed); cogDisplay.MouseDown += new MouseEventHandler(CogDisplay_MouseDown); parentWindow.Controls.Clear(); parentWindow.Controls.Add(cogDisplay); ((System.ComponentModel.ISupportInitialize)(cogDisplay)).EndInit(); if (_cogDisplayWindows.Count > 0) { cogDisplay.Image = _cogDisplayWindows[0].Image; } _cogDisplayWindows.Add(cogDisplay); cogDisplay.AutoFit = true; if (!this.ValidCamera) { try { Bitmap bm = MCore.Comp.VisionSystem.Properties.Resources.InvalidCamera; cogDisplay.Image = new CogImage24PlanarColor(bm); } catch { } } CrossHairsControl crossHairsCtl = new CrossHairsControl(cogDisplay, ValidCamera) { Name = CROSSHAIRSCTLNAME }; parentWindow.Controls.Add(crossHairsCtl); crossHairsCtl.BringToFront(); cogDisplay.Tag = crossHairsCtl; } }
private void CogDisplay_MouseDown(object sender, MouseEventArgs e) { CogDisplay cogDisplay = sender as CogDisplay; if (cogDisplay != null) { CrossHairsControl crossHairsCtl = cogDisplay.Tag as CrossHairsControl; if (crossHairsCtl != null) { crossHairsCtl.CogMouseDown(e); } } }