Contains() 공개 메소드

Contains Method
Checks if a Point lies within this Rectangle.
public Contains ( Point pt ) : bool
pt Point
리턴 bool
예제 #1
0
 void FindSelectedUserBoxes()
 {
     //find users box in selected area
     int j = this.userBoxes.Count;
     var primSelectionBox = selectionBox.GetPrimaryRenderElement(rootgfx);
     var primGlobalPoint = primSelectionBox.GetGlobalLocation();
     var selectedRectArea = new Rectangle(primGlobalPoint, primSelectionBox.Size);
     this.selectionSet.Clear();
     List<CustomWidgets.EaseBox> selectedList = new List<CustomWidgets.EaseBox>();
     for (int i = 0; i < j; ++i)
     {
         var box = userBoxes[i];
         var primElement = box.GetPrimaryRenderElement(rootgfx);
         if (!primElement.Visible)
         {
             continue;
         }
         //get global area 
         Point globalLocation = primElement.GetGlobalLocation();
         var userElementArea = new Rectangle(globalLocation, primElement.Size);
         if (selectedRectArea.Contains(userElementArea))
         {
             //selected= true;
             selectedList.Add(box);
             //------
             //create user controller box for the selected box 
             UIControllerBox userControllerBox = GetFreeControllerBox();
             userControllerBox.TargetBox = box;
             userControllerBox.SetLocation(box.Left - 5, box.Top - 5);
             userControllerBox.SetSize(box.Width + 10, box.Height + 10);
             userControllerBox.Visible = true;
             userControllerBox.Focus();
             selectionSet.AddSelection(userControllerBox);
         }
     }
 }
        void FindSelectedUserBoxes()
        {
            //find users box in selected area



            int j = this.bgbox.ChildCount;
            var primSelectionBox = selectionBox.GetPrimaryRenderElement(rootgfx);
            var primGlobalPoint = primSelectionBox.GetGlobalLocation();
            var selectedRectArea = new Rectangle(primGlobalPoint, primSelectionBox.Size);
            List<UIBox> selectedList = new List<UIBox>();
            for (int i = 0; i < j; ++i)
            {
                var box = bgbox.GetChild(i) as UIBox;
                if (box == null)
                {
                    continue;
                }
                var primElement = box.GetPrimaryRenderElement(rootgfx);
                if (!primElement.Visible)
                {
                    continue;
                }
                //get global area 
                Point globalLocation = primElement.GetGlobalLocation();
                var userElementArea = new Rectangle(globalLocation, primElement.Size);
                if (selectedRectArea.Contains(userElementArea))
                {
                    //selected= true;
                    selectedList.Add(box);
                    //------
                    //create user controller box for the selected box 
                    UIControllerBox userControllerBox = GetFreeUserControllerBox();
                    userControllerBox.TargetBox = box;
                    var globalTargetPos = box.GetGlobalLocation();
                    userControllerBox.SetLocation(globalTargetPos.X - 5, globalTargetPos.Y - 5);
                    userControllerBox.SetSize(box.Width + 10, box.Height + 10);
                    userControllerBox.Visible = true;
                    viewport.AddContent(userControllerBox);
                }
            }
        }