Exemple #1
0
        private void btnImportTask_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = colorconfig.location;
            ofd.Filter           = "dsc任务描述文件|*.dsc|所有文件|*.*";
            ofd.Multiselect      = true;
            ofd.ValidateNames    = true;
            ofd.CheckPathExists  = true;
            ofd.CheckFileExists  = true;

            // clear status
            broi[0]                        = broi[1] = broi[2] = broi[3] = false;
            isimporttask[0]                = isimporttask[1] = isimporttask[2] = isimporttask[3] = false;
            tdscs[0]                       = tdscs[1] = tdscs[2] = tdscs[3] = null;
            tdscs_storepath[0]             =
                tdscs_storepath[1]         =
                    tdscs_storepath[2]     =
                        tdscs_storepath[3] = @"";
            GC.Collect();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Refresh();
                foreach (var filename in ofd.FileNames)
                {
                    FullSlideScanHelper.RectConverter.TaskDesc tdsc = RectConverter.RestoreTaskDesc(filename);
                    tdscs[tdsc.slideid] = tdsc;

                    tdscs_storepath[tdsc.slideid] = filename;
                    broi[tdsc.slideid]            = true;
                    //setnames[tdsc.slideid] = Path.GetFileNameWithoutExtension(filename);

                    rectsROI[tdsc.slideid] = tdsc.rectRoi;
                    rectsBLK[tdsc.slideid] = tdsc.rectBlk;

                    isimporttask[tdsc.slideid] = true;
                    RefreshUI();

                    rect    = rectsROI[tdsc.slideid];
                    idxRect = tdsc.slideid;

                    RectangleF debugrectf = tdsc.rectRoiF;
                    SizeF      sizef      = debugrectf.Size;
                    tp_lu = debugrectf.Location;
                    tp_ru = new PointF(debugrectf.Left - sizef.Width, debugrectf.Top);
                    tp_ld = new PointF(debugrectf.Left, debugrectf.Top - sizef.Height);
                    tp_rd = new PointF(debugrectf.Left - sizef.Width, debugrectf.Top - sizef.Height);

                    label6.Text = tp_lu.ToString();
                    label7.Text = tp_ru.ToString();
                    label8.Text = tp_ld.ToString();
                    label9.Text = tp_rd.ToString();
                    int x_total_steps = (int)((tp_ld.X - tp_rd.X) / x_step);
                    int y_total_steps = (int)((tp_ld.Y - tp_lu.Y) / y_step);
                    label10.Text = "size: (" + Math.Abs(x_total_steps).ToString() + ", " + Math.Abs(y_total_steps).ToString() + ")";
                }
            }
        }