![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Problem Modifying Adorners I'm trying to implement Adorners for some visual objects (Selecting multiple Controls on a canvas at once and moving them using Dragging ). the best resource i've found is Henry Hahn's example on his blog: http://blogs.msdn.com/henryh/archive...19/440854.aspx i tried to select multiple items by clicking on them holding the control Key and setting the Selected bool to false if (Keyboard.Modifiers == ModifierKeys.Control) { selected = false; } if (e.Source != myCanvas) { _isDown = true; _startPoint = e.GetPosition(myCanvas); selectedElement = e.Source as UIElement; _originalLeft = Canvas.GetLeft(selectedElement); _originalTop = Canvas.GetTop(selectedElement); aLayer = AdornerLayer.GetAdornerLayer(selectedElement); aLayer.Add(new ResizingAdorner(selectedElement)); selected = true; SelectCount ++; //SelectCount is count of multiple // controls selected e.Handled = true; } Worked fine till here , but the build stumbles when try to release all the controls selected by Adorners : if (selected) // if a control is selected using adorner { selected = false; if (selectedElement != null) { for(int i=0;i< SelectCount;i++) //SelectCount is count of multiple // controls selected { // Remove the adorner from the selected element aLayer.Remove(aLayer.GetAdorners(selectedElement)[i]); } selectedElement = null; } } This line--> aLayer.Remove(aLayer.GetAdorners(selectedElement)[i]); is always throwing array out of index exception, am i trying the right way to do it ? Also can the selected controls can be moved around as we do it in the Desktop ? Please Help !!!! thanks all! |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| modifying customsettings.ini | Vista installation & setup | |||
| Problem with Vista deleting, modifying files on an XP drive | Vista General | |||
| Modifying the Welcome Center | Vista General | |||
| Modifying a post | PowerShell | |||