Ejemplo n.º 1
0
        private void UpdateEditor()
        {
            if (_editor != null)
            {
                _editor.VisualContainer.Children.CollectionChanged -= Controls_CollectionChanged;
                _editor.SelectedItems.CollectionChanged            -= SelectedControls_CollectionChanged;
            }

            if (Editor is PanelDocument)
            {
                _editor = (Editor as PanelDocument).PanelEditor;
            }
            else if (Editor is MonitorDocument)
            {
                _editor = (Editor as MonitorDocument).MonitorEditor;
            }
            else
            {
                _editor = null;
            }

            if (_editor != null)
            {
                _editor.VisualContainer.Children.CollectionChanged += Controls_CollectionChanged;
                _editor.SelectedItems.CollectionChanged            += SelectedControls_CollectionChanged;
            }

            CopyControlsList();
        }
Ejemplo n.º 2
0
        public SelectionAdorner(HeliosVisualContainerEditor adornedElement)
            : base(adornedElement)
        {
            if (adornedElement.SelectedItems == null)
            {
                throw new Exception("timing bug encountered in processing selections; editor cannot be null");
            }
            _children = new VisualCollection(this);
            _editor   = adornedElement;
            _editor.SelectedItems.CollectionSizeChanged += new EventHandler(SelectedItems_PropertyChanged);
            _editor.GotKeyboardFocus  += new KeyboardFocusChangedEventHandler(Editor_GotKeyboardFocus);
            _editor.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Editor_LostKeyboardFocus);

            _drawFocus = Keyboard.FocusedElement?.Equals(_editor) ?? false;

            SelectionBorderPen.DashStyle = DashStyles.Dash;
            SelectionResizeBrush.Opacity = 0.5d;

            BuildAdornerCorner(ref _topLeft, Cursors.SizeNWSE, new DragStartedEventHandler(TopLeft_DragStarted));
            BuildAdornerCorner(ref _topRight, Cursors.SizeNESW, new DragStartedEventHandler(TopRight_DragStarted));
            BuildAdornerCorner(ref _bottomLeft, Cursors.SizeNESW, new DragStartedEventHandler(BottomLeft_DragStarted));
            BuildAdornerCorner(ref _bottomRight, Cursors.SizeNWSE, new DragStartedEventHandler(BottomRight_DragStarted));

            CheckLine();
        }
Ejemplo n.º 3
0
        public SelectionAdorner(HeliosVisualContainerEditor adornedElement)
            : base(adornedElement)
        {
            _children = new VisualCollection(this);
            _editor   = adornedElement;
            _editor.SelectedItems.CollectionSizeChanged += new EventHandler(SelectedItems_PropertyChanged);
            _editor.GotKeyboardFocus  += new KeyboardFocusChangedEventHandler(Editor_GotKeyboardFocus);
            _editor.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Editor_LostKeyboardFocus);

            _drawFocus = Keyboard.FocusedElement.Equals(_editor);

            SelectionBorderPen.DashStyle = DashStyles.Dash;
            SelectionResizeBrush.Opacity = 0.5d;

            BuildAdornerCorner(ref _topLeft, Cursors.SizeNWSE, new DragStartedEventHandler(TopLeft_DragStarted));
            BuildAdornerCorner(ref _topRight, Cursors.SizeNESW, new DragStartedEventHandler(TopRight_DragStarted));
            BuildAdornerCorner(ref _bottomLeft, Cursors.SizeNESW, new DragStartedEventHandler(BottomLeft_DragStarted));
            BuildAdornerCorner(ref _bottomRight, Cursors.SizeNWSE, new DragStartedEventHandler(BottomRight_DragStarted));

            CheckLine();
        }