コード例 #1
0
        public bool ContainsPoint(float X, float Y)
        {
            for (int i = _GroupItem.Count - 1; i >= 0; i--)
            {
                Item It = (Item)_GroupItem[i];
                switch (It.TypeShape)
                {
                case Nows.Line:
                    Line L = (Line)_GroupItem[i];
                    if (L.ContainsPoint(X, Y))
                    {
                        return(true);
                    }
                    break;

                case Nows.Rec:
                    Rec R = (Rec)_GroupItem[i];
                    if (R.ContainsPoint(X, Y))
                    {
                        return(true);
                    }
                    break;

                case Nows.Ellip:
                case Nows.Pie:
                    Pie P = (Pie)_GroupItem[i];
                    if (P.ContainsPoint(X, Y))
                    {
                        return(true);
                    }
                    break;

                case Nows.Group:
                    GroupItem GI = (GroupItem)_GroupItem[i];
                    if (GI.ContainsPoint(X, Y))
                    {
                        return(true);
                    }
                    break;

                default:
                    break;
                }
            }
            return(false);
        }
コード例 #2
0
        public Object FindShape(float X, float Y)
        {
            for (int i = _Items.Count - 1; i >= 0; i--)
            {
                switch (_Items.GetTypeOfObj(i))
                {
                case Nows.Line:
                    Line L = (Line)_Items[i];
                    if (L.ContainsPoint(X, Y))
                    {
                        return(_Items[i]);
                    }
                    break;

                case Nows.Rec:
                    Rec R = (Rec)_Items[i];
                    if (R.ContainsPoint(X, Y))
                    {
                        return(_Items[i]);
                    }
                    break;

                case Nows.Ellip:
                case Nows.Pie:
                    Pie P = (Pie)_Items[i];
                    if (P.ContainsPoint(X, Y))
                    {
                        return(_Items[i]);
                    }
                    break;

                case Nows.Group:
                    GroupItem GI = (GroupItem)_Items[i];
                    if (GI.ContainsPoint(X, Y))
                    {
                        return(_Items[i]);
                    }
                    break;
                }
            }
            return(null);
        }
コード例 #3
0
        public bool ContainsPoint(float X, float Y, bool CtrlPressed)
        {
            //bool result = false;
            for (int i = _Item.Count - 1; i >= 0; i--)
            {
                //  if (result) return result;
                Item It = (Item)_Item[i];
                switch (It.TypeShape)
                {
                case Nows.Line:
                    Line L = (Line)_Item[i];
                    if (L.ContainsPoint(X, Y))
                    {
                        if (CtrlPressed)
                        {
                            _Item.RemoveAt(i);
                        }
                        return(true);
                    }
                    break;

                case Nows.Rec:
                    Rec R = (Rec)_Item[i];
                    if (R.ContainsPoint(X, Y))
                    {
                        if (CtrlPressed)
                        {
                            _Item.RemoveAt(i);
                        }
                        return(true);
                    }
                    break;

                case Nows.Ellip:
                case Nows.Pie:
                    Pie P = (Pie)_Item[i];
                    if (P.ContainsPoint(X, Y))
                    {
                        if (CtrlPressed)
                        {
                            _Item.RemoveAt(i);
                        }
                        return(true);
                    }
                    break;

                case Nows.Group:
                    GroupItem GI = (GroupItem)_Item[i];
                    if (GI.ContainsPoint(X, Y))
                    {
                        if (CtrlPressed)
                        {
                            _Item.RemoveAt(i);
                        }
                        return(true);
                    }
                    break;

                default:
                    break;
                }
            }
            return(false);
        }