示例#1
0
 private void NeuronDisplay_MouseClick(object sender, MouseEventArgs e)
 {
     Form1.GetInstance().DeselectEveryting();
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         selectedNeuron = this;
         Form1.GetInstance().UpdatePanel();
         this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     }
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         if (selectedNeuron != null)
         {
             linkedNeuron.AddInput(selectedNeuron.linkedNeuron);
             Form1.GetInstance().UpdatePanel();
         }
     }
 }
示例#2
0
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                Neuron spawnedNeuron;

                if (rbNeuron.Checked)
                {
                    spawnedNeuron = new Neuron();
                }
                else if (rbInputNeuron.Checked)
                {
                    spawnedNeuron = new InputNeuron();
                }
                else if (rbOutputNeuron.Checked)
                {
                    spawnedNeuron = new OutputNeuron();
                    ((OutputNeuron)spawnedNeuron).OutputEvent += (obj, args) => MessageBox.Show("AYY LMAO");
                }
                else
                {
                    throw new InvalidOperationException("No radio button is checked!");
                }

                myNetwork.AddNeuron(spawnedNeuron);
                NeuronDisplay disp = new NeuronDisplay(spawnedNeuron);
                disp.Location = new Point(Cursor.Position.X - this.Location.X, Cursor.Position.Y - this.Location.Y);
                this.Controls.Add(disp);
                disp.BringToFront();
            }
        }