Пример #1
0
        private void Planets_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.Moons.IndexFromPoint(e.Location);

            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                var item = (Moon)Moons.Items[index];
                moon = new MoonControl(item, this);
                mainTableLayoutPanel.Controls.Add(moon, 1, 0);
            }
        }
Пример #2
0
 public PlanetForm(Planet planet)
 {
     this.planet = planet;// ?? new Planet(star);
     InitializeComponent();
     //dateTimePicker1.MinDate = new DateTime(0, 0, 0);
     LoadPlanet();
     Moons.MouseDoubleClick     += Planets_MouseDoubleClick;
     Moons.SelectedIndexChanged += (sender, args) => { button2.Enabled = Moons.SelectedItem is Planet; };
     button2.Click       += button2_Click;
     comboBox1.Text       = comboBox1.Items[0] as string;
     comboBox2.Text       = comboBox2.Items[0] as string;
     button2.Click       += (sender, args) => { };
     addMoonButton.Click += (sender, args) =>
     {
         InitializePlanet();
         moon = new MoonControl(new Moon(planet), this);
         mainTableLayoutPanel.Controls.Add(moon, 1, 0);
     };
     Closing        += PlanetForm_Closing;
     button2.Enabled = false;
 }