public PlugInfoAdorner(UIElement parent)
     : base(parent) {
     IsHitTestVisible = false; // Seems Adorner is hit test visible?
     adornedElement = parent as FrameworkElement;
     visualChildern = new VisualCollection(this);
     buildInfoDrawing();
 }
示例#2
0
        public ElementAdorner(UIElement adornedElement, IControlBox controlBox)
            : base(adornedElement)
        {
            visualChildren = new VisualCollection(this);

            FrameworkElement box = controlBox as FrameworkElement;
            this.controlBox = box;
            panel.Children.Add(box);
            panel.Orientation = Orientation.Vertical;
            visualChildren.Add(panel);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref resizeThumb, Cursors.SizeNWSE);

            // Add handlers for resizing.

            resizeThumb.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
            this.ProcessControlBox(controlBox);
            this.MouseEnter += new MouseEventHandler(adornedElement_MouseEnter);
            this.MouseLeave += new MouseEventHandler(adornedElement_MouseLeave);
            this.AdornedElement.MouseEnter += new MouseEventHandler(adornedElement_MouseEnter);
            this.AdornedElement.MouseLeave += new MouseEventHandler(adornedElement_MouseLeave);
            this.Opacity = 0;
        }
        // Initialize the ResizingAdorner.
        public ScatterResizeAdorner(FrameworkElement adornedElement, ScatterViewItem scatterViewItem)
            : base(adornedElement)
        {
            svi = scatterViewItem;

            this.adornedElement = adornedElement;
            visualChildren = new VisualCollection(this);

            BuildAdornerCornerRotate(ref rotate, Cursors.Hand);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref topLeft, Cursors.SizeNWSE);
            BuildAdornerCorner(ref topRight, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomLeft, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomRight, Cursors.SizeNWSE);

            // Add handlers for resizing.
            bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
            bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
            topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
            topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);

            rotate.DragDelta += new DragDeltaEventHandler(HandleRotate);
        }
示例#4
0
 public SizeAdorner(FrameworkElement designerItem)
     : base(designerItem)
 {
     SnapsToDevicePixels = true;
     _chrome = new SizeChrome {DataContext = designerItem};
     _visuals = new VisualCollection(this) {_chrome};
 }
示例#5
0
 public ResizingAdorner(UIElement adornedElement, Size originalSize)
     : base(adornedElement) {
     _visualChildren = new VisualCollection(this);
     _originalSize = _desiredSize = originalSize;
     Width = Height = double.NaN;
     _bottomRight = BuildAdornerCorner(Cursors.SizeNWSE);
 }
        public PasswordBoxHintAdorner(UIElement adornedElement, string hintText, Style hintStyle, VisibilityDelegate visibilityCallback)
          : base(adornedElement)
        {
            _visibilityCallback = visibilityCallback;

            _label = new Label()
            {
                Content = hintText,
                Style = hintStyle,
            };

            IsHitTestVisible = true;
            Visibility = Visibility.Visible;

            adornedElement.GotFocus += Invalidate;
            adornedElement.LostFocus += Invalidate;
            adornedElement.IsVisibleChanged += Invalidate;

            _visualCollection = new VisualCollection(this);
            _contentPresenter = new ContentPresenter();
            _visualCollection.Add(_contentPresenter);
            _contentPresenter.Content = _label;

            AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement);
            adornerLayer?.Add(this);

            IsHitTestVisible = false;
        }
		public VisualAdorner(FrameworkElement adornerElement, UIElement adornedElement)
			: base(adornedElement) {
			children = new VisualCollection(this);
			child = adornerElement;
			children.Add(child);
			AddLogicalChild(child);
		}
示例#8
0
 public SelectionAdorner(UIElement adornedElement)
     : base(adornedElement)
 {
     IsClipEnabled = true;
     visualChildren = new VisualCollection(this);
     BuildAdornerCorner();
 }
示例#9
0
        // Initialize the HelperAdorner.
        public HelperAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            visualChildren = new VisualCollection(this);

            adornedElement.RenderTransformOrigin = new Point(0.5, 0.5);
            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref topLeft, Cursors.Hand);
            BuildAdornerCorner(ref topRight, Cursors.Hand);
            BuildAdornerCorner(ref bottomLeft, Cursors.Hand);
            BuildAdornerCorner(ref bottomRight, Cursors.Hand);
            BuildAdornerCorner(ref centerTop, Cursors.Hand);

            topLeft.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
            topLeft.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaTopLeft);

            topRight.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
            topRight.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaTopRight);

            bottomLeft.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
            bottomLeft.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaBottomLeft);

            bottomRight.DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted);
            bottomRight.DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDeltaBottomRight);

            centerTop.DragDelta += new DragDeltaEventHandler(HandleCenterTop);
            centerTop.DragStarted += new DragStartedEventHandler(this.RotateThumb_DragStarted);
        }
示例#10
0
        // Phương thức khởi tạo
        public ResizingAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            visualChildren = new VisualCollection(this);

            // Khởi tạo các anchor point
            BuildAdorner(ref topLeft, Cursors.SizeNWSE);
            BuildAdorner(ref topRight, Cursors.SizeNESW);
            BuildAdorner(ref bottomLeft, Cursors.SizeNESW);
            BuildAdorner(ref bottomRight, Cursors.SizeNWSE);
            BuildAdorner(ref middleTop, Cursors.SizeNS);
            BuildAdorner(ref middleBottom, Cursors.SizeNS);
            BuildAdorner(ref middleLeft, Cursors.SizeWE);
            BuildAdorner(ref middleRight, Cursors.SizeWE);

            // Các sự kiện tương ứng với mỗi anchor point
            bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
            bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
            topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
            topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);
            middleTop.DragDelta += new DragDeltaEventHandler(HandleMiddleTop);
            middleBottom.DragDelta += new DragDeltaEventHandler(HandleMiddleBottom);
            middleLeft.DragDelta += new DragDeltaEventHandler(HandleMiddleLeft);
            middleRight.DragDelta += new DragDeltaEventHandler(HandleMiddleRight);
        }
示例#11
0
        public ResizeAdorner(PanelDesigner panelDesigner, UIElement adornedElement)
            : base(adornedElement)
        {
            m_panelDesigner = panelDesigner;
            m_panelDesigner.SelectedElementChanged += m_panelDesigner_SelectedElementChanged;
            m_visualChildren = new VisualCollection(this);

            m_rectangle = new Rectangle();
            m_rectangle.Stroke = m_panelDesigner.SelectedElement == AdornedElement ? Brushes.CornflowerBlue : Brushes.LightBlue;
            m_rectangle.StrokeThickness = 1;
            m_visualChildren.Add(m_rectangle);

            BuildResizeAdorner(ref m_bottom, Cursors.SizeNS);
            BuildResizeAdorner(ref m_bottomLeft, Cursors.SizeNESW);
            BuildResizeAdorner(ref m_bottomRight, Cursors.SizeNWSE);
            BuildResizeAdorner(ref m_left, Cursors.SizeWE);
            BuildResizeAdorner(ref m_right, Cursors.SizeWE);
            BuildResizeAdorner(ref m_top, Cursors.SizeNS);
            BuildResizeAdorner(ref m_topLeft, Cursors.SizeNWSE);
            BuildResizeAdorner(ref m_topRight, Cursors.SizeNESW);

            m_bottom.DragDelta += new DragDeltaEventHandler(HandleBottom);
            m_bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
            m_bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
            m_left.DragDelta += new DragDeltaEventHandler(HandleLeft);
            m_right.DragDelta += new DragDeltaEventHandler(HandleRight);
            m_top.DragDelta += new DragDeltaEventHandler(HandleTop);
            m_topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
            m_topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);
        }
示例#12
0
 public AdornerContentPresenter (UIElement adornedElement)
     : base(adornedElement)
 {
     _Visuals = new VisualCollection(this);
     _ContentPresenter = new ContentPresenter();
     _Visuals.Add(_ContentPresenter);
 }
示例#13
0
        public LoadingAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            VisualChildren = new VisualCollection(adornedElement);

            CreateVisual();
        }
示例#14
0
        public DrawingPane()
        {
            this.children = new VisualCollection(this);
            this.drawing = new DrawingVisual();

            this.children.Add(this.drawing);
        }
示例#15
0
        public SOMVisual(SOMVisualType type, int size, int width, int height, PictureSOM.SOM s)
        {
            _visualType = type;
            _boardSize = PictureSOM.SOMConstants.NUM_NODES_ACROSS; // assuming that across and down are the same
            _boardWidthFactor = (width - (2 * _border)) / size;
            _boardHeightFactor = (height - (2 * _border)) / size;

            _som = s;

            _children = new VisualCollection(this);
            DrawBoard();
            _children.Add(_boardDrawingVisual); // Render the grid

            if (_visualType == SOMVisualType.COMPETITION_LAYER_MAP)
            {
                CreateDrawingVisual_Text(s);
            }
            else if(_visualType == SOMVisualType.COMPETITION_LAYER_MAP_FIXED)
            {
                CreateDrawingVisual_Text_Fixed(s);
            }
            else if (_visualType == SOMVisualType.ERROR_MAP)
            {
                CreateDrawingVisual_ErrorMap(s);
            }
            _children.Add(_drawingVisual);

            // Add the event handler for MouseLeftButtonUp.
            this.MouseLeftButtonUp += new MouseButtonEventHandler(SOMVisual_MouseLeftButtonUp);
        }
示例#16
0
        public AutoCompleteTextBox()
        {
            _controls = new VisualCollection(this);
            InitializeComponent();

            _autoCompletionList = new ObservableCollection<AutoCompleteEntry>();
            _searchThreshold = 2;        // default threshold to 2 char

            // set up the key press timer
            _keypressTimer = new System.Timers.Timer();
            _keypressTimer.Elapsed += OnTimedEvent;

            // set up the text box and the combo box
            ComboBox = new ComboBox
            {
                IsSynchronizedWithCurrentItem = true,
                IsTabStop = false
            };

            ComboBox.SelectionChanged += comboBox_SelectionChanged;

            _textBox = new TextBox();
            _textBox.TextChanged += textBox_TextChanged;
            _textBox.VerticalContentAlignment = VerticalAlignment.Center;

            _controls.Add(ComboBox);
            _controls.Add(_textBox);
        }
示例#17
0
        public IsRequiredAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            VisualChildren = new VisualCollection(this);

            CreatePath();
        }
示例#18
0
        // Initialize the ResizingAdorner.
        public ScreenResizeAdorner(UIElement adornedElement, ScreenDocument screen)
            : base(adornedElement)
        {
            Screen = screen;

            visualChildren = new VisualCollection(this);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref top, Cursors.SizeNS);
            BuildAdornerCorner(ref right, Cursors.SizeWE);
            BuildAdornerCorner(ref left, Cursors.SizeWE);
            BuildAdornerCorner(ref bottom, Cursors.SizeNS);

            // Add handlers for resizing.
            left.DragDelta += new DragDeltaEventHandler(HandleLeft);
            bottom.DragDelta += new DragDeltaEventHandler(HandleBottom);
            top.DragDelta += new DragDeltaEventHandler(HandleTop);
            right.DragDelta += new DragDeltaEventHandler(HandleRight);

            right.DragStarted += DragStarted;

            adornedElement.MouseEnter += adornedElement_MouseEnter;
            adornedElement.MouseLeave += adornedElement_MouseLeave;
            this.Visibility = System.Windows.Visibility.Hidden;
        }
示例#19
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="adornedElement"></param>
        public ResizingAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            visualChildren = new VisualCollection(this);
            mainrec = new Rectangle();
            SolidColorBrush brush = new SolidColorBrush(Colors.DimGray);

            mainrec.Stroke = Brushes.Firebrick;
            DoubleCollection col = new DoubleCollection();
            col.Add(5.0);
            col.Add(2.30);
            mainrec.StrokeDashArray = col;
            visualChildren.Add(mainrec);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref topLeft, Cursors.SizeNWSE);
            BuildAdornerCorner(ref topRight, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomLeft, Cursors.SizeNESW);
            BuildAdornerCorner(ref bottomRight, Cursors.SizeNWSE);

            // Add handlers for resizing.
            bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
            bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
            topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
            topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);

            this.MinWidth = 50;

        }
示例#20
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MyVisualHost()
        {
            children = new VisualCollection(this);

            MouseLeftButtonDown += new MouseButtonEventHandler(MyVisualHost_MouseLeftButtonDown);
            MouseRightButtonDown += new MouseButtonEventHandler(MyVisualHost_MouseRightButtonDown);
        }
示例#21
0
        private VisualCollection _visualChildren; //visual children.

        #endregion Fields

        #region Constructors

        public EditBoxAdorner(EditBox editBox, UIElement adornedElement)
            : base(adornedElement)
        {
            _editBox = editBox;
            _visualChildren = new VisualCollection(this);
            BuildTextBox();
        }
示例#22
0
        // Be sure to call the base class constructor.
        public ContentAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            this.children = new VisualCollection(this);

            //
            // Create the content control
            //
            var contentControl = new ContentControl();

            //
            // Bind the content control to the Adorner's ContentTemplate property, so we know what to display
            //
            var contentTemplateBinding = new Binding();
            contentTemplateBinding.Path = new PropertyPath(AdornerContentTemplateProperty);
            contentTemplateBinding.Source = adornedElement;
            contentControl.SetBinding(ContentControl.ContentTemplateProperty, contentTemplateBinding);

            //
            // Add the ContentControl as a child
            //
            this.child = contentControl;
            this.children.Add(this.child);
            this.AddLogicalChild(this.child);
        }
示例#23
0
 public VisualHost()
 {
     _children = new VisualCollection(this);
     _points = new List<Point>();
     _edgePen.Freeze();
     _vertexPen.Freeze();
 }
        public AutoCompleteTextBox()
        {
            controls = new VisualCollection(this);
            InitializeComponent();

            searchThreshold = 2;        // default threshold to 2 char

            // set up the key press timer
            keypressTimer = new System.Timers.Timer();
            keypressTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);

            // set up the text box and the combo box
            comboBox = new ComboBox();
            comboBox.IsSynchronizedWithCurrentItem = true;
            comboBox.IsTabStop = false;
            comboBox.SelectionChanged += new SelectionChangedEventHandler(comboBox_SelectionChanged);

            textBox = new TextBox();
            textBox.TextChanged += new TextChangedEventHandler(textBox_TextChanged);
            textBox.VerticalContentAlignment = VerticalAlignment.Center;

            controls.Add(comboBox);
            controls.Add(textBox);

        }
 public FileListLookupBoxAdorner(FrameworkElement adornedElement)
     : base(adornedElement)
 {
     _adornedElement = adornedElement;
     _visualChildren = new VisualCollection(this);
     BuildTextBox();
 }
示例#26
0
        public ResizingAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            IsClipEnabled = true;
            ClipToBounds = true;

            visualChildren = new VisualCollection(this);

            topLeft = CreateAdornerCorner(Cursors.SizeNWSE);

            topRight = CreateAdornerCorner(Cursors.SizeNESW);
            bottomLeft = CreateAdornerCorner(Cursors.SizeNESW);
            bottomRight = CreateAdornerCorner(Cursors.SizeNWSE);

            left = CreateAdornerCorner(Cursors.SizeWE);
            right = CreateAdornerCorner(Cursors.SizeWE);
            top = CreateAdornerCorner(Cursors.SizeNS);
            bottom = CreateAdornerCorner(Cursors.SizeNS);

            bottomLeft.DragDelta += HandleDrag;
            bottomRight.DragDelta += HandleDrag;
            topLeft.DragDelta += HandleDrag;
            topRight.DragDelta += HandleDrag;

            left.DragDelta += HandleDrag;
            right.DragDelta += HandleDrag;
            top.DragDelta += HandleDrag;
            bottom.DragDelta += HandleDrag;
        }
示例#27
0
 public WaveFormVisual()
 {
     maxPoints = new List<Point>();
     minPoints = new List<Point>();
     _children = new VisualCollection(this);
     _children.Add(CreateWaveFormVisual());            
 }
示例#28
0
        /// <summary>
        /// Initialize the ResizingAdorner.
        /// </summary>
        /// <param name="adornedElement">The element to be adorned.</param>
        public ResizingAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            _visualChildren = new VisualCollection(this);

            //Creates the dashed rectangle around the adorned element.
            BuildAdornerBorder();

            //Call a helper method to initialize the Thumbs with a customized cursors.
            BuildAdornerCorner(ref _topLeft, Cursors.SizeNWSE);
            BuildAdornerCorner(ref _topRight, Cursors.SizeNESW);
            BuildAdornerCorner(ref _bottomLeft, Cursors.SizeNESW);
            BuildAdornerCorner(ref _bottomRight, Cursors.SizeNWSE);

            BuildAdornerCorner(ref _middleBottom, Cursors.SizeNS);
            BuildAdornerCorner(ref _middleTop, Cursors.SizeNS);
            BuildAdornerCorner(ref _leftMiddle, Cursors.SizeWE);
            BuildAdornerCorner(ref _rightMiddle, Cursors.SizeWE);

            //Add handlers for resizing • Corners
            _bottomLeft.DragDelta += HandleBottomLeft;
            _bottomRight.DragDelta += HandleBottomRight;
            _topLeft.DragDelta += HandleTopLeft;
            _topRight.DragDelta += HandleTopRight;

            //Add handlers for resizing • Sides
            _middleBottom.DragDelta += HandleBottomMiddle;
            _middleTop.DragDelta += HandleTopMiddle;
            _leftMiddle.DragDelta += HandleLeftMiddle;
            _rightMiddle.DragDelta += HandleRightMiddle;
        }
示例#29
0
 public ResizeAdorner(UIElement adornedElement)
     : base(adornedElement)
 {
     _visualChildren = new VisualCollection(this);
     _control = new ResizeControl {DataContext = adornedElement};
     _visualChildren.Add(_control);
 }
示例#30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdornerLayer"/> class.
 /// </summary>
 /// <param name="uv">The Ultraviolet context.</param>
 /// <param name="name">The element's identifying name within its namescope.</param>
 public AdornerLayer(UltravioletContext uv, String name)
     : base(uv, name)
 {
     adorners = new VisualCollection(this);
     adornersStates = new List<AdornerState>();
     adornersTemp = new List<Adorner>();
 }
示例#31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualPresenter"/> class.
 /// </summary>
 public VisualPresenter()
 {
     _children = new VisualCollection(this);
 }
示例#32
0
        /// <summary>
        /// Attaches a stroke visual to the tree based on the stroke's
        /// drawing attributes and/or its z-order (index in the collection).
        /// </summary>
        private void AttachVisual(StrokeVisual visual, bool buildingStrokeCollection)
        {
            System.Diagnostics.Debug.Assert(_strokes != null);

            if (visual.Stroke.DrawingAttributes.IsHighlighter)
            {
                // Find or create a container visual for highlighter strokes of the color
                ContainerVisual parent = GetContainerVisual(visual.Stroke.DrawingAttributes);
                Debug.Assert(visual is StrokeVisual);

                //insert StrokeVisuals under any non-StrokeVisuals used for dynamic inking
                int i = 0;
                for (int j = parent.Children.Count - 1; j >= 0; j--)
                {
                    if (parent.Children[j] is StrokeVisual)
                    {
                        i = j + 1;
                        break;
                    }
                }
                parent.Children.Insert(i, visual);
            }
            else
            {
                // For regular ink we have to respect the z-order of the strokes.
                // The implementation below is not optimal in a generic case, but the
                // most simple and should work ok in most common scenarios.

                // Find the nearest non-highlighter stroke with a lower z-order
                // and insert the new visual right next to the visual of that stroke.
                StrokeVisual precedingVisual = null;
                int          i = 0;
                if (buildingStrokeCollection)
                {
                    Stroke visualStroke = visual.Stroke;
                    //we're building up a stroke collection, no need to start at IndexOf,
                    i = Math.Min(_visuals.Count, _strokes.Count); //not -1, we're about to decrement
                    while (--i >= 0)
                    {
                        if (object.ReferenceEquals(_strokes[i], visualStroke))
                        {
                            break;
                        }
                    }
                }
                else
                {
                    i = _strokes.IndexOf(visual.Stroke);
                }
                while (--i >= 0)
                {
                    Stroke stroke = _strokes[i];
                    if ((stroke.DrawingAttributes.IsHighlighter == false) &&
                        (_visuals.TryGetValue(stroke, out precedingVisual) == true) &&
                        (VisualTreeHelper.GetParent(precedingVisual) != null))
                    {
                        VisualCollection children = ((ContainerVisual)(VisualTreeHelper.GetParent(precedingVisual))).Children;
                        int index = children.IndexOf(precedingVisual);
                        children.Insert(index + 1, visual);
                        break;
                    }
                }
                // If found no non-highlighter strokes with a lower z-order, insert
                // the stroke at the very bottom of the regular ink visual tree.
                if (i < 0)
                {
                    ContainerVisual parent = GetContainerVisual(visual.Stroke.DrawingAttributes);
                    parent.Children.Insert(0, visual);
                }
            }
        }
示例#33
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public VisualsPanel()
 {
     visuals        = new VisualCollection(this);
     LayoutUpdated += visualsPanel_LayoutUpdated;
 }
示例#34
0
 public VisualLayers()
 {
     _children = new VisualCollection(this);
 }
示例#35
0
 public WaveFormVisual()
 {
     visualCollection = new VisualCollection(this);
     this.Reset();
     this.SizeChanged += new SizeChangedEventHandler(WaveFormVisual_SizeChanged);
 }
示例#36
0
 public MarkersVisualHost()
 {
     visualChildren = new VisualCollection(this);
     UpdateMarkersVisual(null);
     visualChildren.Add(markers);
 }
 public WpfLayers()
 {
     m_children = new VisualCollection(this);
 }
 /// <summary>
 /// Initialises a new empty SmileyFaceVisual control with default values.
 /// </summary>
 public SmileyFaceFrameworkElement()
 {
     visuals = new VisualCollection(this);
     Loaded += SmileyFace_Loaded;
 }
示例#39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UIChildrenCollection"/> class.
 /// </summary>
 internal UIChildrenCollection(UIElement visualParent, FrameworkElement logicalParent)
     : base(visualParent, logicalParent)
 {
     hostPanel      = (IndividualArrangePanel)visualParent;
     visualChildren = new VisualCollection(visualParent);
 }
示例#40
0
 public SplitPanel()
 {
     splitters      = new VisualCollection(this);
     sortedChildren = new List <UIElement>();
 }
示例#41
0
 public AdornerLayer()
 {
     this.children       = new VisualCollection((Visual)this);
     this.LayoutUpdated += new EventHandler(this.OnLayoutUpdated);
 }
示例#42
0
 public ResizingAdorner(UIElement adornedElement)
     : base(adornedElement)
 {
     visualChildren = new VisualCollection(this);
     bottomRight    = BuildAdornerCorner(Cursors.SizeNWSE, HandleBottomRight);
 }
示例#43
0
 public Container()
 {
     _visuals = new VisualCollection(this);
 }
示例#44
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            // Query subpage details
            PTS.FSSUBPAGEDETAILS subpageDetails;
            PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails));

            // Draw border and background info.
            MbpInfo mbpInfo = MbpInfo.FromElement(Paragraph.Element);

            if (ThisFlowDirection != PageFlowDirection)
            {
                mbpInfo.MirrorBP();
            }

            Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            Visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk);

            ContainerVisual pageContentVisual;
            ContainerVisual floatingElementsVisual;

            if (_visual.Children.Count != 2)
            {
                _visual.Children.Clear();
                _visual.Children.Add(new ContainerVisual());
                _visual.Children.Add(new ContainerVisual());
            }

            pageContentVisual      = (ContainerVisual)_visual.Children[0];
            floatingElementsVisual = (ContainerVisual)_visual.Children[1];


            // Subpage content may be simple or complex -
            // depending of set of features used in the content of the subpage.
            // (1) simple subpage (contains only one track)
            // (2) complex subpage (contains columns)
            if (PTS.ToBoolean(subpageDetails.fSimple))
            {
                // (1) simple subpage (contains only one track)
                PTS.FSKUPDATE fskupd = subpageDetails.u.simple.trackdescr.fsupdinf.fskupd;
                if (fskupd == PTS.FSKUPDATE.fskupdInherited)
                {
                    fskupd = fskupdInherited;
                }
                VisualCollection visualChildren = pageContentVisual.Children;
                if (fskupd == PTS.FSKUPDATE.fskupdNew)
                {
                    visualChildren.Clear();
                    visualChildren.Add(new ContainerVisual());
                }
                // For complex subpage SectionVisual is added. So, when morphing
                // complex subpage to simple one, remove SectionVisual.
                else if (visualChildren.Count == 1 && visualChildren[0] is SectionVisual)
                {
                    visualChildren.Clear();
                    visualChildren.Add(new ContainerVisual());
                }
                Debug.Assert(visualChildren.Count == 1 && visualChildren[0] is ContainerVisual);
                ContainerVisual trackVisual = (ContainerVisual)visualChildren[0];

                PtsHelper.UpdateTrackVisuals(PtsContext, trackVisual.Children, fskupdInherited, ref subpageDetails.u.simple.trackdescr);
            }
            else
            {
                // (2) complex page (contains columns)
                // cBasicColumns == 0, means that subpage content is empty
                bool emptySubpage = (subpageDetails.u.complex.cBasicColumns == 0);
                if (!emptySubpage)
                {
                    // Retrieve description for each column.
                    PTS.FSTRACKDESCRIPTION[] arrayColumnDesc;
                    PtsHelper.TrackListFromSubpage(PtsContext, _paraHandle.Value, ref subpageDetails, out arrayColumnDesc);

                    emptySubpage = (arrayColumnDesc.Length == 0);
                    if (!emptySubpage)
                    {
                        PTS.FSKUPDATE fskupd = fskupdInherited;
                        ErrorHandler.Assert(fskupd != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
                        Debug.Assert(fskupd != PTS.FSKUPDATE.fskupdNoChange);

                        // For complex subpage SectionVisual is added. So, when morphing
                        // simple subpage to complex one, remove ParagraphVisual.
                        VisualCollection visualChildren = pageContentVisual.Children;
                        if (visualChildren.Count == 0)
                        {
                            visualChildren.Add(new SectionVisual());
                        }
                        else if (!(visualChildren[0] is SectionVisual))
                        {
                            visualChildren.Clear();
                            visualChildren.Add(new SectionVisual());
                        }
                        Debug.Assert(visualChildren.Count == 1 && visualChildren[0] is SectionVisual);
                        SectionVisual sectionVisual = (SectionVisual)visualChildren[0];

                        // Draw column rules.
                        ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(Paragraph.Element);
                        sectionVisual.DrawColumnRules(ref arrayColumnDesc, TextDpi.FromTextDpi(subpageDetails.u.complex.fsrc.v), TextDpi.FromTextDpi(subpageDetails.u.complex.fsrc.dv), columnProperties);

                        visualChildren = sectionVisual.Children;
                        if (fskupd == PTS.FSKUPDATE.fskupdNew)
                        {
                            visualChildren.Clear();
                            for (int index = 0; index < arrayColumnDesc.Length; index++)
                            {
                                visualChildren.Add(new ContainerVisual());
                            }
                        }
                        ErrorHandler.Assert(visualChildren.Count == arrayColumnDesc.Length, ErrorHandler.ColumnVisualCountMismatch);
                        for (int index = 0; index < arrayColumnDesc.Length; index++)
                        {
                            ContainerVisual trackVisual = (ContainerVisual)visualChildren[index];

                            PtsHelper.UpdateTrackVisuals(PtsContext, trackVisual.Children, fskupdInherited, ref arrayColumnDesc[index]);
                        }
                    }
                }
                if (emptySubpage)
                {
                    // There is no content, remove all existing visuals.
                    _visual.Children.Clear();
                }
            }

            pageContentVisual.Offset      = new PTS.FSVECTOR(ContentRect.u, ContentRect.v).FromTextDpi();
            floatingElementsVisual.Offset = new PTS.FSVECTOR(ContentRect.u, ContentRect.v).FromTextDpi();

            PTS.FSRECT clipRect = new PTS.FSRECT(_paddingRect.u - _contentRect.u, _paddingRect.v - _contentRect.v, _paddingRect.du, _paddingRect.dv);
            PtsHelper.ClipChildrenToRect(_visual, clipRect.FromTextDpi());
            PtsHelper.UpdateFloatingElementVisuals(floatingElementsVisual, _pageContextOfThisPage.FloatingElementList);
        }
示例#45
0
 public TraceDisplay()
 {
     visualChildren = new VisualCollection(this);
 }
 public AxisControl()
 {
     this.SnapsToDevicePixels = true;
     visuals = new VisualCollection(this);
 }
示例#47
0
 public static void Dump(VisualCollection graphicsList)
 {
     Dump(graphicsList, "Graphics List");
 }
示例#48
0
        public CroppingAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            CropEnabled     = false;
            _visualChildren = new VisualCollection(this);

            _drawingSelection = false;
            _adornedElement   = adornedElement;
            _selectRect       = new Rect();
            _geometry         = new RectangleGeometry();

            var dashes = new DoubleCollection(new double[] { 6, 1 });

            Rubberband = new Path
            {
                Data            = _geometry,
                StrokeThickness = 2,
                Stroke          = Brushes.White,
                StrokeDashArray = dashes,
                Opacity         = 0.6,
                Visibility      = Visibility.Hidden
            };

            _visualChildren.Add(Rubberband);

            // A transparent black background to show outside the crop area over the rest
            // of the image
            Fill = new SolidColorBrush(Color.FromArgb(110, 0, 0, 0));

            _cropMask = new PuncturedRect();
            _cropMask.IsHitTestVisible = false;
            _cropMask.RectInterior     = _selectRect;
            _cropMask.Fill             = Fill;
            _cropMask.Visibility       = Visibility.Hidden;

            _visualChildren.Add(_cropMask);

            // We're going to put the thumbs in a canvas, since the events and placement
            // actually work correctly in a canvas.
            _thumbsCanvas = new Canvas();
            _thumbsCanvas.HorizontalAlignment = HorizontalAlignment.Stretch;
            _thumbsCanvas.VerticalAlignment   = VerticalAlignment.Stretch;
            _visualChildren.Add(_thumbsCanvas);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.

            _thumbSize = new Size(10, 10);
            BuildAdornerCorner(ref _topLeft, Cursors.SizeNWSE);
            BuildAdornerCorner(ref _topRight, Cursors.SizeNESW);
            BuildAdornerCorner(ref _bottomLeft, Cursors.SizeNESW);
            BuildAdornerCorner(ref _bottomRight, Cursors.SizeNWSE);

            // Add handlers for resizing.
            _bottomLeft.DragDelta  += HandleBottomLeft;
            _bottomRight.DragDelta += HandleBottomRight;
            _topLeft.DragDelta     += HandleTopLeft;
            _topRight.DragDelta    += HandleTopRight;

            MouseMove += DrawSelection;
            MouseUp   += EndSelection;

            SetElementVisibility(Visibility.Hidden);
        }
        public ComposingAdorner2(UIElement adornedElement, Maniglie qualiManiglie) : base(adornedElement)
        {
            visualChildren = new VisualCollection(this);

            // --- GRUPPO
            transformGroup = adornedElement.RenderTransform as TransformGroup;
            if (transformGroup == null)
            {
                transformGroup = new TransformGroup();
            }

            // --- ROTAZIONE
            if (qualiManiglie == Maniglie.All || (qualiManiglie & Maniglie.Rotate) == Maniglie.Rotate)
            {
                rotateHandle        = new Thumb();
                rotateHandle.Cursor = Cursors.Hand;
                rotateHandle.Width  = HANDLESIZE;
                rotateHandle.Height = HANDLESIZE;

                rotateHandle.Background     = Brushes.Blue;
                rotateHandle.DragStarted   += rotateHandle_DragStarted;
                rotateHandle.DragDelta     += rotateHandle_DragDelta;
                rotateHandle.DragCompleted += rotateHandle_DragCompleted;

                //
                rotateTfx = initRotateBinding();
                transformGroup.Children.Add(rotateTfx);
            }

            // --- FLIP SPECCHIO
            if (qualiManiglie == Maniglie.All || (qualiManiglie & Maniglie.Flip) == Maniglie.Flip)
            {
                flipHandle                   = new Thumb();
                flipHandle.Cursor            = Cursors.Hand;
                flipHandle.Width             = 20;
                flipHandle.Height            = 20;
                flipHandle.MinWidth          = 20;
                flipHandle.MinHeight         = 20;
                flipHandle.Background        = Brushes.Orange;
                flipHandle.PreviewMouseDown += new MouseButtonEventHandler(flipHandle_MouseDown);
            }

            // --- MOVE SPOSTA TRASLA
            if (qualiManiglie == Maniglie.All || (qualiManiglie & Maniglie.Move) == Maniglie.Move)
            {
                moveHandle            = new Thumb();
                moveHandle.Cursor     = Cursors.SizeAll;
                moveHandle.Width      = double.NaN;             // grande quanto tutta la foto
                moveHandle.Height     = double.NaN;             // grande quanto tutta la foto
                moveHandle.Background = Brushes.Transparent;
                moveHandle.Opacity    = 0;

                moveHandle.DragDelta            += new DragDeltaEventHandler(moveHandle_DragDelta);
                moveHandle.DragStarted          += new DragStartedEventHandler(moveHandle_DragStarted);
                moveHandle.DragCompleted        += new DragCompletedEventHandler(moveHandle_DragCompleted);
                moveHandle.MouseRightButtonDown += new MouseButtonEventHandler(moveHandle_PreviewMouseRightButtonDown);
                moveHandle.PreviewMouseWheel    += moveHandle_PreviewMouseWheel;

                //
                translateTfx = initTransformBinding();
                transformGroup.Children.Add(translateTfx);
            }

            // --- SCALE ZOOM
            if (qualiManiglie == Maniglie.All || (qualiManiglie & Maniglie.Scale) == Maniglie.Scale)
            {
                scaleHandle            = new Thumb();
                scaleHandle.Cursor     = Cursors.SizeNS;
                scaleHandle.Width      = 20;
                scaleHandle.Height     = 20;
                scaleHandle.MinWidth   = 20;
                scaleHandle.MinHeight  = 20;
                scaleHandle.Background = Brushes.Green;

                scaleHandle.DragStarted   += scaleHandle_DragStarted;
                scaleHandle.DragDelta     += scaleHandle_DragDelta;
                scaleHandle.DragCompleted += scaleHandle_DragCompleted;

                //
                scaleFactor = 1;
                scaleTfx    = initScaleBinding();
                // TODO vedremo
                // scaleRotella = new ScaleTransform();

                transformGroup.Children.Add(scaleTfx);
            }


            // ---
            outline = new Path();

            outline.Stroke          = Brushes.Blue;
            outline.StrokeThickness = 1;

            visualChildren.Add(outline);

            if (rotateHandle != null)
            {
                visualChildren.Add(rotateHandle);
            }
            if (moveHandle != null)
            {
                visualChildren.Add(moveHandle);
            }
            if (scaleHandle != null)
            {
                visualChildren.Add(scaleHandle);
            }
            if (flipHandle != null)
            {
                visualChildren.Add(flipHandle);
            }

            adornedElement.RenderTransform = transformGroup;
        }
示例#50
0
 // Token: 0x0600662E RID: 26158 RVA: 0x00002137 File Offset: 0x00000337
 internal virtual void Arrange(VisualCollection vc, Vector lineOffset)
 {
 }
示例#51
0
 public LowGraphicsVisualHost()
 {
     children = new VisualCollection(this);
 }
 public VisualHost()
 {
     this.Children           = new VisualCollection(this);
     this.MouseLeftButtonUp += MyVisualHost_MouseLeftButtonUp;
 }
示例#53
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            PTS.FSSUBPAGEDETAILS fssubpagedetails;
            PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails));
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (base.ThisFlowDirection != base.PageFlowDirection)
            {
                mbpInfo.MirrorBP();
            }
            Brush backgroundBrush = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            this.Visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk);
            if (this._visual.Children.Count != 2)
            {
                this._visual.Children.Clear();
                this._visual.Children.Add(new ContainerVisual());
                this._visual.Children.Add(new ContainerVisual());
            }
            ContainerVisual containerVisual  = (ContainerVisual)this._visual.Children[0];
            ContainerVisual containerVisual2 = (ContainerVisual)this._visual.Children[1];

            if (PTS.ToBoolean(fssubpagedetails.fSimple))
            {
                PTS.FSKUPDATE fskupdate = fssubpagedetails.u.simple.trackdescr.fsupdinf.fskupd;
                if (fskupdate == PTS.FSKUPDATE.fskupdInherited)
                {
                    fskupdate = fskupdInherited;
                }
                VisualCollection children = containerVisual.Children;
                if (fskupdate == PTS.FSKUPDATE.fskupdNew)
                {
                    children.Clear();
                    children.Add(new ContainerVisual());
                }
                else if (children.Count == 1 && children[0] is SectionVisual)
                {
                    children.Clear();
                    children.Add(new ContainerVisual());
                }
                ContainerVisual containerVisual3 = (ContainerVisual)children[0];
                PtsHelper.UpdateTrackVisuals(base.PtsContext, containerVisual3.Children, fskupdInherited, ref fssubpagedetails.u.simple.trackdescr);
            }
            else
            {
                bool flag = fssubpagedetails.u.complex.cBasicColumns == 0;
                if (!flag)
                {
                    PTS.FSTRACKDESCRIPTION[] array;
                    PtsHelper.TrackListFromSubpage(base.PtsContext, this._paraHandle.Value, ref fssubpagedetails, out array);
                    flag = (array.Length == 0);
                    if (!flag)
                    {
                        ErrorHandler.Assert(fskupdInherited != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
                        VisualCollection children2 = containerVisual.Children;
                        if (children2.Count == 0)
                        {
                            children2.Add(new SectionVisual());
                        }
                        else if (!(children2[0] is SectionVisual))
                        {
                            children2.Clear();
                            children2.Add(new SectionVisual());
                        }
                        SectionVisual         sectionVisual    = (SectionVisual)children2[0];
                        ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(base.Paragraph.Element);
                        sectionVisual.DrawColumnRules(ref array, TextDpi.FromTextDpi(fssubpagedetails.u.complex.fsrc.v), TextDpi.FromTextDpi(fssubpagedetails.u.complex.fsrc.dv), columnProperties);
                        children2 = sectionVisual.Children;
                        if (fskupdInherited == PTS.FSKUPDATE.fskupdNew)
                        {
                            children2.Clear();
                            for (int i = 0; i < array.Length; i++)
                            {
                                children2.Add(new ContainerVisual());
                            }
                        }
                        ErrorHandler.Assert(children2.Count == array.Length, ErrorHandler.ColumnVisualCountMismatch);
                        for (int j = 0; j < array.Length; j++)
                        {
                            ContainerVisual containerVisual4 = (ContainerVisual)children2[j];
                            PtsHelper.UpdateTrackVisuals(base.PtsContext, containerVisual4.Children, fskupdInherited, ref array[j]);
                        }
                    }
                }
                if (flag)
                {
                    this._visual.Children.Clear();
                }
            }
            containerVisual.Offset  = new PTS.FSVECTOR(this.ContentRect.u, this.ContentRect.v).FromTextDpi();
            containerVisual2.Offset = new PTS.FSVECTOR(this.ContentRect.u, this.ContentRect.v).FromTextDpi();
            PTS.FSRECT fsrect = new PTS.FSRECT(this._paddingRect.u - this._contentRect.u, this._paddingRect.v - this._contentRect.v, this._paddingRect.du, this._paddingRect.dv);
            PtsHelper.ClipChildrenToRect(this._visual, fsrect.FromTextDpi());
            PtsHelper.UpdateFloatingElementVisuals(containerVisual2, this._pageContextOfThisPage.FloatingElementList);
        }
 public BasicGraph()
 {
     vc                  = new VisualCollection(this);
     this.Loaded        += new RoutedEventHandler(Draw_Loaded);
     this.LayoutUpdated += new EventHandler(Draw_Updated);
 }
示例#55
0
 public BoardLayout()
 {
     children = new VisualCollection(this);
 }
示例#56
0
 public VisualHost()
 {
     visualCollection = new VisualCollection(this);
 }
示例#57
0
        // ------------------------------------------------------------------
        // Arrange content of formatted line.
        //
        //      vc - Visual collection of the parent.
        //      lineOffset - Offset of the line.
        // ------------------------------------------------------------------
        internal override void Arrange(VisualCollection vc, Vector lineOffset)
        {
            // Arrange inline objects
            int runDcp = _dcp;
            IList <TextSpan <TextRun> > runs = _line.GetTextRunSpans();

            Debug.Assert(runs != null, "Cannot retrieve runs collection.");

            // Calculate offset shift due to trailing spaces
            double adjustedXOffset = lineOffset.X + CalculateXOffsetShift();

            foreach (TextSpan <TextRun> textSpan in runs)
            {
                TextRun run = textSpan.Value;
                if (run is InlineObject)
                {
                    InlineObject inlineObject = run as InlineObject;

                    // Disconnect visual from its old parent, if necessary.
                    Visual currentParent = VisualTreeHelper.GetParent(inlineObject.Element) as Visual;
                    if (currentParent != null)
                    {
                        ContainerVisual parent = currentParent as ContainerVisual;
                        Invariant.Assert(parent != null, "parent should always derives from ContainerVisual");
                        parent.Children.Remove(inlineObject.Element);
                    }

                    // Get position of inline object withing the text line.
                    FlowDirection flowDirection;
                    Rect          rect = GetBoundsFromPosition(runDcp, inlineObject.Length, out flowDirection);
                    Debug.Assert(DoubleUtil.GreaterThanOrClose(rect.Width, 0), "Negative inline object's width.");

                    ContainerVisual proxyVisual = new ContainerVisual();
                    if (inlineObject.Element is FrameworkElement)
                    {
                        FlowDirection parentFlowDirection = _owner.FlowDirection;
                        // Check parent's FlowDirection to determine if mirroring is needed

                        DependencyObject parent = ((FrameworkElement)inlineObject.Element).Parent;
                        if (parent != null)
                        {
                            parentFlowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty);
                        }

                        PtsHelper.UpdateMirroringTransform(_owner.FlowDirection, parentFlowDirection, proxyVisual, rect.Width);
                    }
                    vc.Add(proxyVisual);

                    if (_owner.UseLayoutRounding)
                    {
                        // If using layout rounding, check whether rounding needs to compensate for high DPI
                        proxyVisual.Offset = new Vector(UIElement.RoundLayoutValue(lineOffset.X + rect.Left, FrameworkElement.DpiScaleX),
                                                        UIElement.RoundLayoutValue(lineOffset.Y + rect.Top, FrameworkElement.DpiScaleY));
                    }
                    else
                    {
                        proxyVisual.Offset = new Vector(lineOffset.X + rect.Left, lineOffset.Y + rect.Top);
                    }
                    proxyVisual.Children.Add(inlineObject.Element);

                    // Combine text line offset (relative to the Text control) with inline object
                    // offset (relative to the line) and set transorm on the visual. Trailing spaces
                    // shift is not added here because it is returned by GetBoundsFromPosition
                    inlineObject.Element.Arrange(new Rect(inlineObject.Element.DesiredSize));
                }

                // Do not use TextRun.Length, because it gives total length of the run.
                // So, if the run is broken between lines, it gives incorrect value.
                // Use length of the TextSpan instead, which gives the correct length here.
                runDcp += textSpan.Length;
            }
        }
示例#58
0
 /// <summary>
 /// Initializes a new empty SmileyFaceVisual control with default values.
 /// </summary>
 public SmileyFaceUIElement()
 {
     visuals = new VisualCollection(this);
     visuals.Add(GetFaceDrawingVisual());
 }
示例#59
0
 public DrawingControl()
 {
     visual  = new DrawingVisual();
     visuals = new VisualCollection(this);
     visuals.Add(visual);
 }
 private ConnectedAnimationAdorner([NotNull] UIElement adornedElement)
     : base(adornedElement)
 {
     Children         = new VisualCollection(this);
     IsHitTestVisible = false;
 }