Example #1
0
        public DrawRect(MonoConfig _monoconfig)
        {
            InitializeComponent();

            thisForm = this;

            rectFRoiTotalPoints = 0;
            this.monoconfig     = _monoconfig;
            rectsBLK[0]         = rect1stBLK;
            rectsROI[0]         = RectConverter.rect1stROI;
            rectsBLK[1]         = rect2ndBLK;
            rectsROI[1]         = RectConverter.rect2ndROI;
            rectsBLK[2]         = rect3rdBLK;
            rectsROI[2]         = RectConverter.rect3rdROI;
            rectsBLK[3]         = rect4thBLK;
            rectsROI[3]         = RectConverter.rect4thROI;
            for (int i = 0; i < 4; i++)
            {
                setnames[i] = _monoconfig.name + "-" + i.ToString();
            }
            tp_lu = new PointF();
            tp_ru = new PointF();
            tp_ld = new PointF();
            tp_rd = new PointF();

            for (int i = 0; i < RectConverter.eyepieces.Length; ++i)
            {
                if (RectConverter.eyepieces[i] == _monoconfig.amp)
                {
                    amp = i;
                    break;
                }
            }

            if (amp == 1)
            {
                x_step = RectConverter.xstep_20x;
                y_step = RectConverter.ystep_20x;
            }
            else if (amp == 2)
            {
                x_step = RectConverter.xstep_40x;
                y_step = RectConverter.ystep_40x;
            }

            if (x_step == 0.0F || y_step == 0.0F)
            {
                is_amp_ok = false;
                MessageBox.Show("扫描目前仅支持20x或40x的放大倍数,请重新选择。");
            }
            else
            {
                is_amp_ok = true;
            }


            InfoPanelUtil.MyConsoleWrite(ref thisForm, "hello");
        }
Example #2
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (isStartPointValid)
            {
                blnDraw = false;
                if (rectSel == 1)
                {
                    rectsROI[idxRect] = rect;
                }
                else if (rectSel == 2)
                {
                    rectsBLK[idxRect] = rect;
                }

                //rectsROI[idxRect] = rect;

                RectangleF debugrectf = RectConverter.ConvertFromDrawRect(rect, idxRect);
                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() + ")";



                using (Graphics g = Graphics.FromHwnd(this.pictureBox1.Handle))
                {
                    foreach (Rectangle _rect in rectsROI)
                    {
                        g.DrawRectangle(new Pen(Color.Red, 4), _rect);
                    }

                    foreach (Rectangle _rect in rectsBLK)
                    {
                        g.DrawRectangle(new Pen(Color.Blue, 4), _rect);
                    }
                }

                InfoPanelUtil.MyConsoleWrite(ref thisForm, "Done");
            }
        }
Example #3
0
        public int UpdatePoints(bool isSwitch, Int32 totalPoints)
        {
            cumuTempPoints += 1;
            if (isSwitch)
            {
                currTempPoints = 0;
                InfoPanelUtil.MyConsoleWrite(ref thisForm, "currTempPoints = 0 ");
            }
            else
            {
                currTempPoints += 1;
            }

            currTotalPoints = totalPoints;


            return(RefreshUI());
        }
Example #4
0
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            stPoint = e.Location;
            Invalidate();
            blnDraw = true;

            isStartPointValid = true;

            if (RectConverter.rect1st.Contains(e.Location))
            {
                InfoPanelUtil.MyConsoleWrite(ref thisForm, "attack 1 rect.");
                idxRect = 0;
                rrect   = rects[idxRect];
            }

            else if (RectConverter.rect2nd.Contains(e.Location))
            {
                InfoPanelUtil.MyConsoleWrite(ref thisForm, "attack 2 rect.");
                idxRect = 1;
                rrect   = rects[idxRect];
            }

            else if (RectConverter.rect3rd.Contains(e.Location))
            {
                InfoPanelUtil.MyConsoleWrite(ref thisForm, "attack 3 rect.");
                idxRect = 2;
                rrect   = rects[idxRect];
            }

            else if (RectConverter.rect4th.Contains(e.Location))
            {
                InfoPanelUtil.MyConsoleWrite(ref thisForm, "attack 4 rect.");
                idxRect = 3;
                rrect   = rects[idxRect];
            }
            else
            {
                InfoPanelUtil.MyConsoleWrite(ref thisForm, "attack null rect.");
                blnDraw           = false;
                isStartPointValid = false;
            }
        }