Exemplo n.º 1
0
        private void BOX_MouseUp(object sender, MouseEventArgs e)
        {
            if (_captured && e.Button == MouseButtons.Left)
            {
                _captured = false;
                var p = UpdateCursor(e.Location);
                Task.Run(() => SetText(p.ToString(), false));
                UpdateShapeUnderConstruction(p);
                if (_shape.Width > 0)
                {
                    _shapes.Add(_shape);
                }
                _shape = null;
            }

            UpdateCursor(e.Location);
            base.OnMouseUp(e);
        }
Exemplo n.º 2
0
        private void BOX_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                _captured = true;

                var p = UpdateCursor(e.Location);

                SetText(p.ToString(), false);

                switch (_selectedTool)
                {
                case Tools.Line:
                {
                    _shape = new TLine(p, p);
                }
                break;

                case Tools.Circle:
                {
                    _shape = new TCircle(p, 0);
                }
                break;

                case Tools.Rectangle:
                {
                    _shape = new TRectangle(p, p);
                }
                break;

                default:
                    break;
                }
            }

            base.OnMouseDown(e);
        }