コード例 #1
0
        private void PanelMain_DoubleClick(object sender, EventArgs e)
        {
            var mouseEvent = e as MouseEventArgs;

            if (mouseEvent != null && mouseEvent.Button == MouseButtons.Left)
            {
                var point = new Point(mouseEvent.Location.X, mouseEvent.Location.Y);
                if (_quadrilateralToDraw.AddPoint(point) == false && _doubleClickCounter == 3)
                {
                    _quadrilaterals.Add(_quadrilateralToDraw);
                    _quadrilateralToDraw = new Quadrilateral();
                    Graphic.Redraw(panelMain, _graphics, _quadrilaterals);
                    _doubleClickCounter = 0;
                }
                else
                {
                    _doubleClickCounter++;
                }

                Utils.UI.SetTextToLabel(labelCounter,
                                        $"Додайте ще {Quadrilateral.SIZE - _quadrilateralToDraw.Count()} точки щоб утворити {Quadrilateral.SIZE}-кутник ");
            }
        }
コード例 #2
0
        private void PanelMain_DoubleClick(object sender, EventArgs e)
        {
            MouseEventArgs mouseEvent = e as MouseEventArgs;

            if (mouseEvent.Button == MouseButtons.Left)
            {
                Point point = new Point(mouseEvent.Location.X, mouseEvent.Location.Y);
                if (quadrilateralToDraw.AddPoint(point) == false && doubleClickCounter == 3)
                {
                    quadrilaterals.Add(quadrilateralToDraw);
                    quadrilateralToDraw = new Quadrilateral();
                    Graphic.Redraw(panelMain, graphics, quadrilaterals);
                    doubleClickCounter = 0;
                }
                else
                {
                    doubleClickCounter++;
                }

                UI.SetTextToLabel(labelCounter, string.Format("Додайте ще {0} точки щоб утворити {1}-кутник ", Quadrilateral.SIZE - quadrilateralToDraw.Count(), Quadrilateral.SIZE));
            }
        }