Example #1
0
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            List <Double> input  = new List <double>();
            List <Double> output = new List <double>();

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                SPanel pane = new SPanel(true);
                pane.handle += (fg, sd) => { panel1.Controls.Remove(pane); };
                pane.blc     = Color.Green;
                panel1.Controls.Add(pane);
                pane.Size     = new Size(15, 15);
                pane.Location = e.Location;
                input.Add((double)e.Location.X / (double)Width); input.Add((double)e.Location.Y / (double)Height);
                output.Add(1);
                inp.Add(input.ToArray());
                outp.Add(output.ToArray());
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                SPanel pane = new SPanel(true);
                pane.handle += (fg, sd) => { panel1.Controls.Remove(pane); };
                pane.blc     = Color.Blue;
                panel1.Controls.Add(pane);
                pane.Size     = new Size(15, 15);
                pane.Location = e.Location;
                input.Add((double)e.Location.X / (double)Width); input.Add((double)e.Location.Y / (double)Height);
                output.Add(0);
                inp.Add(input.ToArray());
                outp.Add(output.ToArray());
            }
        }
Example #2
0
        public mtrfrm(List <Double[]> inpt, List <Double[]> outp)
        {
            InitializeComponent();
            inp       = inpt;
            this.outp = outp;
            int cntr = 0;

            DialogResult = DialogResult.Abort;
            foreach (var item in inpt)
            {
                Color clr = Color.Black;
                if (outp[cntr][0] > 0.5)
                {
                    clr = Color.Green;
                }
                else
                {
                    clr = Color.Blue;
                }
                SPanel pane = new SPanel(true);
                pane.handle += (fg, sd) => { panel1.Controls.Remove(pane); };
                pane.blc     = clr;
                panel1.Controls.Add(pane);
                pane.Size     = new Size(15, 15);
                pane.Location = new Point((int)(item[0] * Width), (int)(item[1] * Height));


                cntr += 1;
            }
        }
Example #3
0
        private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (count >= 25)
            {
                if (up == 1)
                {
                }
                else
                {
                    List <Double> input  = new List <double>();
                    List <Double> output = new List <double>();
                    if (e.Button == System.Windows.Forms.MouseButtons.Left)
                    {
                        SPanel pane = new SPanel(true);
                        pane.handle += (fg, sd) => { panel1.Controls.Remove(pane); };
                        pane.blc     = Color.White;
                        panel1.Controls.Add(pane);
                        pane.Size     = new Size(15, 15);
                        pane.Location = e.Location;
                        input.Add(e.Location.X); input.Add(e.Location.Y); output.Add(0);
                        inp.Add(input.ToArray());
                        outp.Add(output.ToArray());
                    }
                    if (e.Button == System.Windows.Forms.MouseButtons.Right)
                    {
                        SPanel pane = new SPanel(true);
                        pane.handle += (fg, sd) => { panel1.Controls.Remove(pane);

                                                     inp.IndexOf(new double[] { }); };
                        pane.blc = Color.White;
                        panel1.Controls.Add(pane);
                        pane.Size     = new Size(15, 15);
                        pane.Location = e.Location;
                        input.Add(e.Location.X); input.Add(e.Location.Y); output.Add(1);
                        inp.Add(input.ToArray());
                        outp.Add(output.ToArray());
                    }
                }
                count = 0;
            }

            count += 1;
        }
Example #4
0
 public void randomize()
 {
     panel1.Controls.Clear();
     for (int i = 0; i < 70; i++)
     {
         List <Double> input  = new List <double>();
         List <Double> output = new List <double>();
         Point         pnt    = new Point(e.Next(0, panel1.Width - 10), e.Next(0, panel1.Height - 10));
         SPanel        pane   = new SPanel(true);
         pane.handle += (fg, sd) => { panel1.Controls.Remove(pane); };
         pane.blc     = Color.White;
         SetDoubleBuffered(pane);
         panel1.Controls.Add(pane);
         pane.Size     = new Size(15, 15);
         pane.Location = pnt;
         input.Add(pnt.X); input.Add(pnt.Y); output.Add(0);
         inp.Add(input.ToArray());
         outp.Add(output.ToArray());
     }
 }