/// <summary> /// �������� /// </summary> /// <param name="subject"></param> public void InsertSubject(SubjectBase subject, int position) { subject.parentSubject = this; subject.SetTitleStyle(); if (!this.childSubjects.Contains(subject)) { if (this.expanded == false) { this.expanded = true; } if (this.childSubjects.Count == 0 || position >= this.childSubjects.Count || position < 0) { this.childSubjects.Add(subject); } else { this.childSubjects.Insert(position, subject); } this.AdjustPosition(); SubjectBase parentSubject = this.ParentSubject; while (parentSubject != null) { parentSubject.AdjustPosition(); parentSubject = parentSubject.ParentSubject; } //SubjectBase topSubject = this.GetTopSubect(); //if (topSubject != null) //{ // topSubject.AdjustPosition(); //} } }