Пример #1
0
 protected override Rectangle[] GetDropTargets(Point dropPoint)
 {
     if (HelpTextRectangle.Contains(dropPoint))
     {
         return new Rectangle[] { HelpTextRectangle }
     }
     ;
     else
     {
         return(GetConnectors());
     }
 }
Пример #2
0
        public override HitTestInfo HitTest(Point point)
        {
            HitTestInfo hitInfo = HitTestInfo.Nowhere;

            if (Expanded && ActiveDesigner == this)
            {
                if (ContainedDesigners.Count == 0 && HelpTextRectangle.Contains(point))
                {
                    hitInfo = new ConnectorHitTestInfo(this, HitTestLocations.Designer, 0);
                }
                else if (this.previewStrip.Bounds.Contains(point))
                {
                    ItemInfo         itemInfo         = this.previewStrip.HitTest(point);
                    ActivityDesigner activityDesigner = (itemInfo != null) ? ActivityDesigner.GetDesigner(itemInfo.UserData[DesignerUserDataKeys.Activity] as Activity) : null;
                    if (activityDesigner != null)
                    {
                        hitInfo = new HitTestInfo(activityDesigner, HitTestLocations.Designer);
                    }
                    else
                    {
                        hitInfo = new HitTestInfo(this, HitTestLocations.Designer | HitTestLocations.ActionArea);
                    }
                }
                else if (ShowPreview && this.previewWindow.Bounds.Contains(point) &&
                         (this.previewWindow.PreviewMode || PreviewedDesigner == null || !PreviewedDesigner.Bounds.Contains(point)))
                {
                    hitInfo = new HitTestInfo(this, HitTestLocations.Designer | HitTestLocations.ActionArea);
                }
                else
                {
                    hitInfo = base.HitTest(point);

                    if (ShowPreview && this.previewWindow.PreviewMode && hitInfo.AssociatedDesigner != this)
                    {
                        hitInfo = HitTestInfo.Nowhere;
                    }
                }
            }
            else
            {
                hitInfo = base.HitTest(point);
            }

            return(hitInfo);
        }
Пример #3
0
        public override HitTestInfo HitTest(Point point)
        {
            if (ActiveDesigner != this)
            {
                return(base.HitTest(point));
            }

            HitTestInfo hitInfo = HitTestInfo.Nowhere;

            if (!Expanded)
            {
                hitInfo = base.HitTest(point);
            }
            else if (ContainedDesigners.Count == 0 && HelpTextRectangle.Contains(point))
            {
                hitInfo = new ConnectorHitTestInfo(this, HitTestLocations.Designer, 0);
            }
            else
            {
                //Check if the hit is on any of the connectors
                Rectangle[] connectors = GetConnectors();
                for (int i = 0; i < connectors.Length; i++)
                {
                    if (connectors[i].Contains(point))
                    {
                        hitInfo = new ConnectorHitTestInfo(this, HitTestLocations.Designer, i);
                        break;
                    }
                }

                if (hitInfo.HitLocation == HitTestLocations.None)
                {
                    hitInfo = base.HitTest(point);
                }
            }

            return(hitInfo);
        }