Пример #1
0
        private void bgImageProcessing_DoWork(object sender, DoWorkEventArgs e)
        {
            List <Bitmap> images = (List <Bitmap>)e.Argument;

            Globals.numberOfAnswerSheet = images.Count;
            int i = 1;

            lstProcessedAS = new List <ProcessedAS>();
            foreach (Bitmap bmp in images)
            {
                ProcessedAS processedAS = ASProcessor.ProcessAS(bmp);
                lstProcessedAS.Add(processedAS);
                int percentages = i * 100 / images.Count;
                bgImageProcessing.ReportProgress(percentages);
                i++;
            }
            String[,] data = CommonHelper.convertListListProcessedAsTo2DArray(lstProcessedAS);

            fillDataToGridView(dgvDetected, data);
            fillDataToGridView(dgvEditing, data);
        }
Пример #2
0
        private void dgvEditing_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > 0 && e.RowIndex <= lstProcessedAS.Count)
            {
                ProcessedAS processedAS = lstProcessedAS[e.RowIndex - 1];
                currentStudentAnswerImage = lstProcessedAS[e.RowIndex - 1].processedAnswerSheetImage;
                pbAnswerSheet.Image       = currentStudentAnswerImage;

                shouldPaint = true;
                if (e.ColumnIndex >= 2)
                {
                    drawPoint          = processedAS.answers[e.ColumnIndex - 2].questionPosition;
                    drawType           = Constant.DRAW_RECT_ON_ANSWER;
                    pbAnswerSheet.Left = -drawPoint.x + 30;
                    pbAnswerSheet.Top  = -drawPoint.y + 250;
                }
                else if (e.ColumnIndex == 0)
                {
                    drawPoint          = new AnswerSheetProcess.Point(1111, 260);
                    drawType           = Constant.DRAW_RECT_ON_STUDENT_ID;
                    pbAnswerSheet.Left = -drawPoint.x + 50;
                    pbAnswerSheet.Top  = -drawPoint.y + 240;
                }
                else if (e.ColumnIndex == 1)
                {
                    drawPoint          = new AnswerSheetProcess.Point(1370, 260);
                    drawType           = Constant.DRAW_RECT_ON_EXAM_ID;
                    pbAnswerSheet.Left = -drawPoint.x + 50;
                    pbAnswerSheet.Top  = -drawPoint.y + 240;
                }
                else
                {
                    shouldPaint = false;
                }
                lbErrorMessage.Visible = true;
                lbErrorMessage.Text    = errorMessages[e.RowIndex, e.ColumnIndex];
            }
        }