Beispiel #1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            var punct = new System.Drawing.Point(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y);

            if (!_inProgres)
            {
                if (_obiectInMove == null)
                {
                    _obiectInProgres      = new Obiect();
                    _linieInProgres       = new Linie();
                    _linieInProgres.Start = punct;

                    _initialPoint = punct;

                    if (checkBox1.Checked)
                    {
                        _drawUtils.DeseneazaVarf(punct, (int)numericUpDown1.Value);
                    }

                    _inProgres = true;
                    _obiectInProgres.Varfuri.Add(punct);
                }
            }
            else
            {
                if (!_isNearInitialPoint)
                {
                    _obiectInProgres.Varfuri.Add(punct);
                    _linieInProgres.End = punct;
                    _obiectInProgres.LiniiPerimetru.Add(new Linie(_linieInProgres));

                    _drawUtils.DeseneazaLinie(_linieInProgres);
                    if (checkBox1.Checked)
                    {
                        _drawUtils.DeseneazaVarf(punct, (int)numericUpDown1.Value);
                    }

                    _linieInProgres       = new Linie();
                    _linieInProgres.Start = punct;
                }
                else
                {
                    _linieInProgres.End = new System.Drawing.Point(_initialPoint.X, _initialPoint.Y);
                    _obiectInProgres.LiniiPerimetru.Add(new Linie(_linieInProgres));

                    //_obiectInProgres.CalculeazaPuncteInterioare(new Point(0, 0), new Point(pictureBox1.Width, pictureBox1.Height));
                    //_objects.Add(_obiectInProgres);

                    _drawUtils.DeseneazaLinie(_linieInProgres);
                    _drawUtils.ColoreazaInteriorObiect(_obiectInProgres, Color.Red, Brushes.Red);

                    _objects.Add(_obiectInProgres);
                    _obiectInProgres.ObiectInitial = new Obiect(_obiectInProgres);
                    _linieInProgres     = null;
                    _obiectInProgres    = null;
                    _inProgres          = false;
                    _isNearInitialPoint = false;
                }
            }
        }