상속: ElementEventArgs
예제 #1
0
 protected virtual void OnElementMouseUp(ElementMouseEventArgs e)
 {
     if (ElementMouseUp != null)
     {
         ElementMouseUp(this, e);
     }
 }
예제 #2
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);
        }
예제 #3
0
		protected virtual void OnElementMouseUp(ElementMouseEventArgs e)
		{
			if (ElementMouseUp != null)
			{
				ElementMouseUp(this, e);
			}
		}
예제 #4
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(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(mousePoint);
				
					AddUndo();
				}
				resizeAction.UpdateResizeCorner();
			}

			RestartInitValues();

			base.Invalidate();

			base.OnMouseUp (e);
		}
예제 #5
0
		protected override void OnMouseDown(MouseEventArgs e)
		{
			Point mousePoint;

			//ShowSelectionCorner((document.Action==DesignerAction.Select));

			switch (document.Action)
			{
				// SELECT
				case DesignerAction.Connect:
				case DesignerAction.Select:
                    if (e.Button == MouseButtons.Left)
                    {
                        mousePoint = Gsc2Goc(new Point(e.X, e.Y));

                        //Verify resize action
                        StartResizeElement(mousePoint);
                        if ((resizeAction != null) && (resizeAction.IsResizing)) break;

                        //Verify label editing
                        if (isEditLabel)
                        {
                            EndEditLabel();
                        }

                        // Search element by click
                        selectedElement = document.FindElement(mousePoint);

                        if (selectedElement != null)
                        {
                            //Events
                            ElementMouseEventArgs eventMouseDownArg = new ElementMouseEventArgs(selectedElement, e.X, e.Y);
                            OnElementMouseDown(eventMouseDownArg);

                            //// Double-click to edit Label
                            //if ((e.Clicks == 2) && (selectedElement is ILabelElement))
                            //{
                            //    //selectedLabel = ((ILabelElement)selectedElement).Label;
                            //    StartEditLabel();
                            //    break;
                            //}

                            //// Element selected
                            //if (selectedElement is ConnectorElement)
                            //{
                            //    StartAddLink((ConnectorElement)selectedElement, mousePoint);
                            //    selectedElement = null;
                            //}
                            //else
                            if(selectedElement.GetType() != typeof(ConnectorElement))
                                StartSelectElements(selectedElement, mousePoint);
                        }
                        else
                        {
                            // If click is on neutral area, clear selection
                            document.ClearSelection();
                            Point p = Gsc2Goc(new Point(e.X, e.Y)); ;
                            isMultiSelection = true;
                            selectionArea.Visible = true;
                            selectionArea.Location = p;
                            selectionArea.Size = new Size(0, 0);

                            if (resizeAction != null)
                                resizeAction.ShowResizeCorner(false);
                        }
                        base.Invalidate();
                    }
                    else
                    {
                        mousePoint = Gsc2Goc(new Point(e.X, e.Y));

                        // Search element by click
                        selectedElement = document.FindElement(mousePoint);

                        if (selectedElement != null)
                        {
                            //Events
                            ElementMouseEventArgs eventMouseDownArg = new ElementMouseEventArgs(selectedElement, e.X, e.Y);
                            OnElementMouseDown(eventMouseDownArg);

                            StartSelectElements(selectedElement, mousePoint);
                        }
                        else
                        {
                            // If click is on neutral area, clear selection
                            document.ClearSelection();
                            Point p = Gsc2Goc(new Point(e.X, e.Y)); ;
                            isMultiSelection = true;
                            selectionArea.Visible = true;
                            selectionArea.Location = p;
                            selectionArea.Size = new Size(0, 0);

                            if (resizeAction != null)
                                resizeAction.ShowResizeCorner(false);
                        }
                        base.Invalidate();
                    }
					break;

				// ADD
				case DesignerAction.Add:

					if (e.Button == MouseButtons.Left)
					{
						mousePoint = Gsc2Goc(new Point(e.X, e.Y));
						StartAddElement(mousePoint);
					}
					break;

				// DELETE
				case DesignerAction.Delete:
					if (e.Button == MouseButtons.Left)
					{
						mousePoint = Gsc2Goc(new Point(e.X, e.Y));
						DeleteElement(mousePoint);
					}					
					break;
			}
			
			base.OnMouseDown (e);
		
		}
예제 #6
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            Point mousePoint;

            //ShowSelectionCorner((document.Action==DesignerAction.Select));

            switch (document.Action)
            {
            // SELECT
            case DesignerAction.Connect:
            case DesignerAction.Select:
                if (e.Button == MouseButtons.Left)
                {
                    mousePoint = Gsc2Goc(new Point(e.X, e.Y));

                    //Verify resize action
                    StartResizeElement(mousePoint);
                    if ((resizeAction != null) && (resizeAction.IsResizing))
                    {
                        break;
                    }

                    // Search element by click
                    selectedElement = document.FindElement(mousePoint);

                    if (selectedElement != null)
                    {
                        //Events
                        ElementMouseEventArgs eventMouseDownArg = new ElementMouseEventArgs(selectedElement, e.X, e.Y);
                        OnElementMouseDown(eventMouseDownArg);

                        // Element selected
                        if (selectedElement is ConnectorElement)
                        {
                            StartAddLink((ConnectorElement)selectedElement, mousePoint);
                            selectedElement = null;
                        }
                        else
                        {
                            StartSelectElements(selectedElement, mousePoint);
                        }
                    }
                    else
                    {
                        // If click is on neutral area, clear selection
                        document.ClearSelection();
                        Point p = Gsc2Goc(new Point(e.X, e.Y));;
                        isMultiSelection       = true;
                        selectionArea.Visible  = true;
                        selectionArea.Location = p;
                        selectionArea.Size     = new Size(0, 0);

                        if (resizeAction != null)
                        {
                            resizeAction.ShowResizeCorner(false);
                        }
                    }
                    base.Invalidate();
                }
                break;

            // ADD
            case DesignerAction.Add:

                if (e.Button == MouseButtons.Left)
                {
                    mousePoint = Gsc2Goc(new Point(e.X, e.Y));
                    StartAddElement(mousePoint);
                }
                break;

            // DELETE
            case DesignerAction.Delete:
                if (e.Button == MouseButtons.Left)
                {
                    mousePoint = Gsc2Goc(new Point(e.X, e.Y));
                    DeleteElement(mousePoint);
                }
                break;
            }

            base.OnMouseDown(e);
        }
예제 #7
0
 private void designer1_ElementMouseUp(object sender, ElementMouseEventArgs e)
 {
     AppendLog("designer1_ElementMouseUp: {0}", e.ToString());
 }