示例#1
0
        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public TestAdorn(IWpfTextView view, TextInvisTagger tit, IViewTagAggregatorFactoryService tafs)
        {
            _view = view;
            _tit = tit;

            tagAggregator = tafs.CreateTagAggregator<TextInvisTag>(_view);

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("FocusArea");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };

            //_tit.ScrollNumberFixed += delegate { this.onSizeChange(); };
            _view.LayoutChanged += delegate { this.onSizeChange(); };            //may have problems
            //_view.LayoutChanged += new EventHandler<TextViewLayoutChangedEventArgs>(_view_LayoutChanged);
        }
示例#2
0
        private ovCode _overviewport = null;                                 //the wpf control to display the overview


        public TestMargin(IWpfTextView textView, TextInvisTagger tit)
        {
            _textView = textView;
            this.ClipToBounds = true;
            this.Background = new SolidColorBrush(Colors.LightCyan);

            _tit = tit;                                    //currently not use this, instead refence the ovcollection in tagger
            _ovc = new OvCollection(this);

            _textView.LayoutChanged += new EventHandler<TextViewLayoutChangedEventArgs>(_textView_LayoutChanged);

            _textView.Caret.PositionChanged += new EventHandler<CaretPositionChangedEventArgs>(Caret_PositionChanged);

            this.MouseMove += new System.Windows.Input.MouseEventHandler(TestMargin_MouseMove);

            this._textView.ViewportHeightChanged += new EventHandler(_textView_ViewportHeightChanged);

            this._textView.ViewportWidthChanged += new EventHandler(_textView_ViewportWidthChanged);
        }