/// <summary>
        /// 监听展开收起变化
        /// </summary>
        /// <param name="iOpenStop">对象</param>
        /// <param name="state">当前状态(需要改变状态)</param>
        private void AddListenOpenStop(IOpenStop iOpenStop, bool state)
        {
            ISelectedControl targetSelectedContrl = iOpenStop as ISelectedControl;

            if (targetSelectedContrl != null)
            {
                if (state)
                {
                    iOpenStop.StopControl(new Point(0, 0));
                }
                else
                {
                    iOpenStop.OpenControl(new Point(0, 0));
                }
                ResetControlRect(targetSelectedContrl.GetParent());
            }
        }
        /// <summary>
        /// 重新设置控件尺寸
        /// </summary>
        /// <param name="parent"></param>
        private void ResetControlRect(Control parent)
        {
            if (parent == null)
            {
                return;
            }
            try
            {
                DialogueConditionControl topControl = parent.Controls.OfType <DialogueConditionControl>().FirstOrDefault();
                #region 构建一个深度结构并计算

                //初步构建
                List <IDialoguePointID>          nextChilds             = new List <IDialoguePointID>();
                List <List <DeepControlStruct> > deepControlStructLists = new List <List <DeepControlStruct> >();
                int tempDeep = 0;
                nextChilds.Add(topControl);
                while (nextChilds.Count > 0)
                {
                    IDialoguePointID[] tempChilds = nextChilds.ToArray();
                    nextChilds.Clear();
                    if (deepControlStructLists.Count == tempDeep)
                    {
                        List <DeepControlStruct> deepControlStructList = new List <DeepControlStruct>();
                        deepControlStructLists.Add(deepControlStructList);
                        deepControlStructList.AddRange(tempChilds.Select(temp => new DeepControlStruct()
                        {
                            deep = tempDeep, iOpenStop = temp as IOpenStop, childs = new List <DeepControlStruct>()
                        }));
                    }
                    foreach (IDialoguePointID tempChild in tempChilds)
                    {
                        IOpenStop iOpenStop = tempChild as IOpenStop;
                        if (iOpenStop != null && iOpenStop.OpenStopState)          //如果该节点是展开节点并且该节点时展开的
                        {
                            nextChilds.AddRange(tempChild.GetDialogueNextPointID); //用于下次计算
                        }
                    }
                    tempDeep++;
                }

                //计算父子关系
                for (int i = 0; i < deepControlStructLists.Count - 1; i++)
                {
                    foreach (DeepControlStruct deepControlStruct in deepControlStructLists[i])
                    {
                        IDialoguePointID    iDialoguePointID       = deepControlStruct.iOpenStop as IDialoguePointID;
                        IDialoguePointID[]  childIDialoguePointIDs = iDialoguePointID.GetDialogueNextPointID;
                        DeepControlStruct[] childs = deepControlStructLists[i + 1].Where(temp => childIDialoguePointIDs.Contains(temp.iOpenStop as IDialoguePointID)).ToArray();
                        foreach (DeepControlStruct child in childs)
                        {
                            child.parent = deepControlStruct;
                            deepControlStruct.childs.Add(child);
                        }
                    }
                }
                //初始化对象的BoundY
                foreach (DeepControlStruct deepControlStruct in deepControlStructLists[0])
                {
                    deepControlStruct.InitBoundY();
                }
                //计算每个节点的x轴坐标
                int tempLocationX = 0;
                for (int i = 0; i < deepControlStructLists.Count; i++)
                {
                    int maxLocationX = 0;
                    foreach (DeepControlStruct deepControlStruct in deepControlStructLists[i])
                    {
                        deepControlStruct.location_x = tempLocationX;
                        int thisWidth = deepControlStruct.iOpenStop.OpenStopState ? deepControlStruct.iOpenStop.OpenSize.Width : deepControlStruct.iOpenStop.StopSize.Width;
                        maxLocationX = maxLocationX > thisWidth ? maxLocationX : thisWidth;
                    }
                    tempLocationX += maxLocationX + 50;
                }
                //计算每个节点的y轴坐标
                foreach (List <DeepControlStruct> deepControlStructList in deepControlStructLists)
                {
                    int tempY = 0;
                    DeepControlStruct parentDeep = null;
                    foreach (DeepControlStruct deepControlStruct in deepControlStructList)
                    {
                        if (deepControlStruct.parent == null)
                        {
                            deepControlStruct.location_y = tempY;
                            tempY += deepControlStruct.boundY;
                        }
                        else
                        {
                            if (parentDeep != deepControlStruct.parent)
                            {
                                tempY      = 0;
                                parentDeep = deepControlStruct.parent;
                            }
                            deepControlStruct.location_y = parentDeep.location_y + tempY;
                            tempY += deepControlStruct.boundY;
                        }
                    }
                }
                //设置父控件大小
                List <int> deepWidthList = new List <int>();
                deepWidthList = deepControlStructLists.Select(temp =>
                                                              temp.Select(deepControl => deepControl.iOpenStop).
                                                              Select(iOpenStop => iOpenStop.OpenStopState ? iOpenStop.OpenSize.Width : iOpenStop.StopSize.Width).
                                                              Max() + 50
                                                              ).ToList();
                int panelWidth  = deepWidthList.Sum();
                int panelHeight = deepControlStructLists[0].Select(temp => temp.boundY).Sum();
                parent.Size = new Size(panelWidth, panelHeight);
                //设置每个节点的大小以及隐藏节点的位置与大小
                Action <IDialoguePointID> HideChild = null;//隐藏子节点
                HideChild = (target) =>
                {
                    IDialoguePointID[] childs = target.GetDialogueNextPointID;
                    foreach (IDialoguePointID child in childs)
                    {
                        (child as Control).Location = new Point(-1000, -1000);
                        HideChild(child);
                    }
                };
                foreach (List <DeepControlStruct> deepControlStructList in deepControlStructLists)
                {
                    foreach (DeepControlStruct deepControlStruct in deepControlStructList)
                    {
                        Control thisControl = deepControlStruct.iOpenStop as Control;
                        thisControl.Location = new Point(deepControlStruct.location_x, deepControlStruct.location_y);
                        thisControl.Size     = deepControlStruct.iOpenStop.OpenStopState ? deepControlStruct.iOpenStop.OpenSize : deepControlStruct.iOpenStop.StopSize;
                        if (!deepControlStruct.iOpenStop.OpenStopState)
                        {
                            HideChild(deepControlStruct.iOpenStop as IDialoguePointID);
                        }
                    }
                }
                //重置背景控件大小
                ResetBackRect();
                #endregion
            }
            catch { }
        }