Exemplo n.º 1
0
        private void drawRectangleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }


            //copy Undo Image
            imgUndo = img.Copy();
            Cursor  = Cursors.WaitCursor; // clock cursor

            int[] matrix = new int[4];    //[xf,xi,yf,yi]
            matrix = ImageClass.Treshold_rectangle(img, 1000);

            //[xf,xi,yf,yi]

            Point bc_centroid1 = new Point(0, 0);

            bc_centroid1.X = matrix[1]; //(matrix[0] - matrix[1])/2;
            bc_centroid1.Y = matrix[3]; //(matrix[2] - matrix[3])/2;


            Size bc_size1 = new Size(0, 0);

            bc_size1.Width  = Math.Abs((matrix[0] - matrix[1]));
            bc_size1.Height = Math.Abs((matrix[2] - matrix[3]));

            string bc_image1  = "ola";
            string bc_number1 = "ola";

            Point bc_centroid2 = new Point(0, 0);

            bc_centroid2.X = 0;
            bc_centroid2.Y = 0;

            Size bc_size2 = new Size(0, 0);

            bc_size2.Width  = 0;
            bc_size2.Height = 0;

            string bc_image2  = "ola";
            string bc_number2 = "ola";


            ImageClass.BarCodeReader(img, 0, out bc_centroid1, out bc_size1, out bc_image1, out bc_number1, out bc_centroid2, out bc_size2, out bc_image2, out bc_number2);


            //ImageClass.BarCodeReader(img, 0, out Point1, new Size (190,71), "imagem", "number", new Point(95, 36), new Size(190, 71), "imagem2", "number2");

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }