Пример #1
0
        /// <summary>
        /// Adds a colony on left mouse click.
        /// Removes a colony on right mouse click.
        /// Selects a color on left mouse click when there is no color selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBox_MouseClick(object sender, MouseEventArgs e)
        {
            if (pictureBox.Image != null && editable == true)
            {
                try
                {
                    //lblColor.Text = "Kleur: " + mainController.inleesViewController.countModel.GetSelectedColor(pictureBox, e);
                }
                catch (ArgumentOutOfRangeException ex)
                {
                    Console.WriteLine(ex);
                }

                if (e.Button == MouseButtons.Left)
                {
                    if (!ResultModel.Berekend)
                    {
                        mainController.colonyController.SetColorRange(pictureBox, e, true);
                        mainController.colonyController.SetColorRange(pictureBox, e, false);
                        OptionSelect       = 1;
                        labelKleur.Visible = false;
                    }
                    else
                    {
                        ColonyController.AddColony(e.X, e.Y, pictureBox, ResultModel);
                        ResultModel.Kolonies = ResultModel.ColonyList.Count;
                        DrawCircles();
                    }
                }
                if (e.Button == MouseButtons.Right)
                {
                    ColonyController.RemoveKolonie(e.X, e.Y, pictureBox, ResultModel);
                    ResultModel.Kolonies = ResultModel.ColonyList.Count;
                    DrawCircles();
                }
            }

            pictureBox.Invalidate();
            SetTextBox();
        }
Пример #2
0
        private void pictureBox_MouseClick(object sender, MouseEventArgs e)
        {
            // CHECK PICTUREBOX IS NOT EMPTY
            if (pictureBox.Image != null)
            {
                if (e.Button == MouseButtons.Left)
                {
                    if (!currentResult.Berekend)
                    {
                        if (OptionSelect == 0)
                        {
                            mainController.colonyController.SetColorRange(pictureBox, e, true, AchtergrondPanelKleur);
                            lblSelect.Text   = "Selecteer een kolonie.";
                            OptionSelect     = 1;
                            btnReset.Enabled = true;
                        }
                        else
                        {
                            mainController.colonyController.SetColorRange(pictureBox, e, false, KoloniePanelKleur);
                            OptionSelect      = 2;
                            lblSelect.Visible = false;
                            btnReset.Enabled  = true;
                        }
                    }
                    else
                    {
                        ColonyController.AddColony(e.X, e.Y, pictureBox, currentResult);
                    }
                }
                if (e.Button == MouseButtons.Right)
                {
                    ColonyController.RemoveKolonie(e.X, e.Y, pictureBox, currentResult);
                }

                DrawCircles();
                pictureBox.Invalidate();
            }

            RefreshTxt();
        }