Esempio n. 1
0
        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            dragging = false;
            PointF p = new PointF();

            p.X = e.X + scrollX;
            p.Y = e.Y + scrollY;

            if (e.Button == MouseButtons.Right)
            {
                saveNewPosX = p.X;
                saveNewPosY = p.Y;

                this.ContextMenu = CntMenuDecoration;
                for (int i = 0; i < outLines.Count; ++i)
                {
                    Outline outLine = (Outline)outLines[i];

                    if (outLine is Ellipse && (outLine as Ellipse).getSegmentIndex(p) < distanceToLine)
                    {
                        currOutline = outLine;
                        return;
                    }

                    if (!(outLine is Ellipse) && outLine.getSegmentIndex(p) > -1)
                    {
                        saveIndex   = i;
                        saveOutline = (SegmentedOutline)outLine;
                        outLine.addMenuItems(CntMenuSegment, p);
                        this.ContextMenu = CntMenuSegment;
                        break;
                    }
                }

                if (saveOutline != null)
                {
                    if (saveOutline.checkOverPoint(p))
                    {
                        if (saveOutline.isAllowCombineCntMenu(p))
                        {
                            this.ContextMenu = CntMenuCombine;
                        }
                    }
                }
            }
            if (e.Button == MouseButtons.Left)
            {
                for (int i = 0; i < outLines.Count; ++i)
                {
                    Outline s = (Outline)outLines[i];
                    if (s.hitTest(p))
                    {
                        dragging    = true;
                        currOutline = s;
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
    protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
    {
      dragging = false;
      PointF p = new PointF();

      p.X = e.X + scrollX;
      p.Y = e.Y + scrollY;

      if (e.Button == MouseButtons.Right)
      {
        saveNewPosX = p.X;
        saveNewPosY = p.Y;

        this.ContextMenu = CntMenuDecoration;
        for (int i = 0; i < outLines.Count; ++i)
        {
          Outline outLine = (Outline)outLines[i];

          if (outLine is Ellipse && (outLine as Ellipse).getSegmentIndex(p) < distanceToLine)
          {
            currOutline = outLine;
            return;
          }

          if (!(outLine is Ellipse) && outLine.getSegmentIndex(p) > -1)
          {
            saveIndex = i;
            saveOutline = (SegmentedOutline)outLine;
            outLine.addMenuItems(CntMenuSegment, p);
            this.ContextMenu = CntMenuSegment;
            break;
          }
        }

        if (saveOutline != null)
          if (saveOutline.checkOverPoint(p))
          {
            if (saveOutline.isAllowCombineCntMenu(p))
              this.ContextMenu = CntMenuCombine;
          }
      }
      if (e.Button == MouseButtons.Left)
      {
        for (int i = 0; i < outLines.Count; ++i)
        {
          Outline s = (Outline)outLines[i];
          if (s.hitTest(p))
          {
            dragging = true;
            currOutline = s;
            break;
          }
        }
      }
    }