Beispiel #1
0
        private PictureBoxDecorator createDecorablePictureBox(PictureBox i_CorePictureBox)
        {
            FramedPictureBox framedPictureBox = new FramedPictureBox(i_CorePictureBox);
            ZoomPictureBox   result           = new ZoomPictureBox(framedPictureBox);

            return(result);
        }
Beispiel #2
0
        private void ZoomPictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            ZoomPictureBox zpb       = (ZoomPictureBox)sender;
            var            offsetX   = zpb.OffsetX;
            var            offsetY   = zpb.OffsetY;
            var            zoomScale = zpb.ZoomScale;
            Point          point     = new Point((int)(e.X / zoomScale) + offsetX, (int)(e.Y / zoomScale) + offsetY);

            label1.Text = point.ToString();
            var fmimg = StaticInfo.FloatMatrixImage;

            try
            {
                if (fmimg != null)
                {
                    var mat = fmimg.matrix;
                    if (point.X < mat.ColumnCount && point.Y < mat.RowCount)
                    {
                        var pixel = mat[point.Y, point.X];
                        var str   = pixel.ToString();
                        if (fmimg.MaximumColorView < pixel)
                        {
                            str += $" ({fmimg.MaximumColorView})";
                        }
                        else if (fmimg.MinimalColorView > pixel)
                        {
                            str += $" ({fmimg.MinimalColorView})";
                        }
                        label2.Text = str;
                    }
                    else
                    {
                        label2.Text = "___";
                    }
                }
            }
            catch (Exception ex)
            {
                label2.Text = ex.Message;
            }
        }