예제 #1
0
 /// <summary>
 /// <para>******************</para>
 /// Watch Gray Level (灰階
 /// <para>******************</para>
 /// </summary>
 /// <param name="viewPort"></param>
 private void setWatchGrayLevel(HWindowControl viewPort, HWndCtrl viewController)
 {
     if (viewPort != null)
     {
         viewPort.HMouseMove += (sender, e) =>
         {
             if (viewController == null)
             {
                 return;
             }
             var currImage = viewController.GetLastHImage();
             if (currImage != null)
             {
                 var row = (int)Math.Round(e.Y, 0);
                 var col = (int)Math.Round(e.X, 0);
                 try
                 {
                     HTuple width, height, grayval;
                     currImage.GetImageSize(out width, out height);
                     var mouseInImage = (row <= height.I && col <= width.I && row >= 0 && col >= 0);
                     if (mouseInImage)
                     {
                         HOperatorSet.GetGrayval(currImage, row, col, out grayval);
                         var dispText = grayval.I.ToString();
                         SetStatus(SystemStatusType.GrayLevel, dispText);
                     }
                 }
                 catch (Exception ex)
                 {
                     AddMessage(ex.Message);
                 }
             }
         };
     }
 }