Exemplo n.º 1
0
        private void mainPicBox_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left && selectMode == SelectMode.Group && groupDrag)
            {
                Point minPt = new Point((int)(Math.Min(groupMStartPnt.X, e.X) / CellW),
                                        (int)(Math.Min(groupMStartPnt.Y, e.Y) / CellH));
                Point maxPt = new Point((int)(Math.Max(groupMStartPnt.X, e.X) / CellW),
                                        (int)(Math.Max(groupMStartPnt.Y, e.Y) / CellH));
                ESDiagnostics diagn = new ESDiagnostics();

                Microbe m = MicrobesList.First;
                while (m != null)
                {
                    Microbe n = m.Next;
                    if (m.X > minPt.X && m.Y > minPt.Y &&
                        m.X < maxPt.X && m.Y < maxPt.Y)
                    {
                        diagn.Add(m);
                    }
                    m = n;
                }
                if (diagn.Count > 0)
                {
                    MicStatsForm msf = new MicStatsForm(diagn.AvgStats(), diagn.Count);
                    msf.Show();
                }
            }
            groupDrag = false;
        }
Exemplo n.º 2
0
        private void diagnoseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ESDiagnostics diagn = new ESDiagnostics();

            Microbe m = MicrobesList.First;

            while (m != null)
            {
                Microbe n = m.Next;
                diagn.Add(m);
                m = n;
            }
            if (diagn.Count > 0)
            {
                MicStatsForm msf = new MicStatsForm(diagn.AvgStats(), diagn.Count);
                msf.Show();
            }
            else
            {
                MessageBox.Show("0 Microbes.", "Diagnostics",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }