示例#1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            Rectangle selectionRectangle = selectionArea.GetUnsignedRectangle();

            if ((moveAction != null) && (moveAction.IsMoving))
            {
                ElementEventArgs eventClickArg = new ElementEventArgs(selectedElement);
                OnElementClick(eventClickArg);

                moveAction.End();
                moveAction = null;

                ElementMouseEventArgs eventMouseUpArg = new ElementMouseEventArgs(selectedElement, e.X, e.Y);
                OnElementMouseUp(eventMouseUpArg);

                if (changed)
                {
                    AddUndo();
                }
            }

            // Select
            if (isMultiSelection)
            {
                EndSelectElements(selectionRectangle);
            }
            // Add element
            else if (isAddSelection)
            {
                EndAddElement(AlignToGrid(selectionRectangle));
            }

            // Add link
            else if (isAddLink)
            {
                Point mousePoint = Gsc2Goc(new Point(e.X, e.Y));
                EndAddLink();

                AddUndo();
            }

            // Resize
            if (resizeAction != null)
            {
                if (resizeAction.IsResizing)
                {
                    Point mousePoint = Gsc2Goc(new Point(e.X, e.Y));
                    resizeAction.End(AlignToGrid(mousePoint));

                    AddUndo();
                }
                resizeAction.UpdateResizeCorner();
            }

            RestartInitValues();

            base.Invalidate();

            base.OnMouseUp(e);
        }
示例#2
0
        protected internal override void Draw(Graphics g)
        {
            IsInvalidated = false;

            Rectangle r = RectangleElement.GetUnsignedRectangle(
                new Rectangle(
                    location.X, location.Y,
                    size.Width, size.Height));

            //Fill rectangle
            Color borderColor1;

            if (opacity == 100)
            {
                borderColor1 = borderColor;
            }
            else
            {
                borderColor1 = Color.FromArgb((int)(255.0f * (opacity / 100.0f)), borderColor);
            }

            Pen p;

            p = new Pen(borderColor1, borderWidth);

            p.StartCap = startCap;
            p.EndCap   = endCap;
            g.DrawLine(p, point1, point2);
            p.Dispose();
        }