117 {
118 base.OnAfterSelect(e);
119
120 if (e.Action == TreeViewAction.ByMouse)
121 {
122 bool bControl = ModifierKeys == Keys.Control;
123 bool bShift = ModifierKeys == Keys.Shift;
124
125 if (bControl)
126 {
127 if (!
m_coll.Contains(e.Node))
128 {
130 }
131 else
132 {
135 }
136
138 }
139 else
140 {
141
142 if (bShift)
143 {
144 Queue<TreeNode> myQueue = new Queue<TreeNode>();
145
147 TreeNode bottomnode = e.Node;
148
150 if (!bParent)
151 {
152 bParent =
isParent(bottomnode, uppernode);
153 if (bParent)
154 {
155 TreeNode t = uppernode;
156 uppernode = bottomnode;
157 bottomnode = t;
158 }
159 }
160
161 if (bParent)
162 {
163 TreeNode n = bottomnode;
164 while (n != (uppernode?.Parent ?? bottomnode))
165 {
167 {
168 myQueue.Enqueue(n);
169 }
170
171 n = n.Parent;
172 }
173 }
174
175 else
176 {
177 if (uppernode.Parent == null && bottomnode.Parent == null || uppernode.Parent != null &&
178 uppernode.Parent.Nodes.Contains(bottomnode))
179 {
180 int nIndexUpper = uppernode.Index;
181 int nIndexBottom = bottomnode.Index;
182 if (nIndexBottom < nIndexUpper)
183 {
184 TreeNode t = uppernode;
185 uppernode = bottomnode;
186 bottomnode = t;
187 nIndexUpper = uppernode.Index;
188 nIndexBottom = bottomnode.Index;
189 }
190
191 TreeNode n = uppernode;
192 while (nIndexUpper <= nIndexBottom)
193 {
195 {
196 myQueue.Enqueue(n);
197 }
198
199 n = n.NextNode;
200
201 nIndexUpper++;
202 }
203 }
204 else
205 {
206 if (!
m_coll.Contains(uppernode))
207 {
208 myQueue.Enqueue(uppernode);
209 }
210
211 if (!
m_coll.Contains(bottomnode))
212 {
213 myQueue.Enqueue(bottomnode);
214 }
215 }
216 }
217
219
222 }
223 else
224 {
225
227 {
230 }
231
233 }
234 }
235 }
236 }
bool isParent(TreeNode parentNode, TreeNode childNode)
Definition: TreeViewMS.cs:244
void removePaintFromNodes()
Definition: TreeViewMS.cs:271
TreeNode m_firstNode
Definition: TreeViewMS.cs:15
void paintSelectedNodes()
Definition: TreeViewMS.cs:262