Esempio n. 1
0
        private void _rasterImageViewer_MouseMove(object sender, MouseEventArgs e)
        {
            string str;

            if (_rasterImageViewer.Image != null && _ocrPage != null)
            {
                // Show the mouse position in physical and logical (inches) coordinates

                PointF physical = new PointF(e.X, e.Y);
                PointF pixels;

                Transformer trans = new Transformer(ToMatrix(_rasterImageViewer.ImageTransform));
                pixels = trans.PointToLogical(physical);

                LeadPoint lPoint    = new LeadPoint((int)Math.Abs(pixels.X), (int)Math.Abs(pixels.Y));
                int       zoneIndex = _ocrPage.HitTestZone(lPoint);
                str = string.Format("{0},{1} px", (int)pixels.X, (int)pixels.Y);
            }
            else
            {
                str = string.Empty;
            }

            _mousePositionLabel.Text = str;
        }
Esempio n. 2
0
        private void _rasterImageViewer_MouseMove(object sender, MouseEventArgs e)
        {
            string str;

            if (_rasterImageViewer.Image != null)
            {
                // Show the mouse position in physical and logical (inches) coordinates

                PointF physical = new PointF(e.X, e.Y);
                PointF pixels;


                Transformer trans = new Transformer(ToMatrix(_rasterImageViewer.ImageTransform));
                pixels = trans.PointToLogical(physical);

                LeadPoint lPoint    = new LeadPoint((int)pixels.X, (int)pixels.Y);
                int       zoneIndex = _ocrPage.HitTestZone(lPoint);
                if (zoneIndex != -1)
                {
                    if (_ocrPage.Zones[zoneIndex].ZoneType == OcrZoneType.Table && _ocrPage.TableZoneManager != null)
                    {
                        try
                        {
                            OcrTablePointInformation tablePointInfo = _ocrPage.TableZoneManager.GetPointInformation(zoneIndex, lPoint, new LeadSize(2, 2));
                            int cellIndex = tablePointInfo.CellIndex + 1;
                            _cellIndexLabel.Text = "Cell Index: " + cellIndex.ToString();
                        }
                        catch (System.Exception /*e*/)
                        {
                            _cellIndexLabel.Text = string.Empty;
                        }
                    }
                    else
                    {
                        _cellIndexLabel.Text = string.Empty;
                    }
                }
                else
                {
                    _cellIndexLabel.Text = string.Empty;
                }


                str = string.Format("{0},{1} px", (int)pixels.X, (int)pixels.Y);
            }
            else
            {
                str = string.Empty;
            }

            _mousePositionLabel.Text = str;
        }