Example #1
0
        public SelectionLayer(EditorView editorView)
        {
            _editorView       = editorView;
            _textSpanList     = new List <TextSpan>();
            _editorViewHelper = new SourceEditorViewHelper(editorView);
            _geometryLookup   = new Dictionary <TextSpan, Geometry>();
            Color highlightColor      = SystemColors.HighlightColor;
            Color startColor          = Color.FromArgb(0x60, highlightColor.R, highlightColor.G, highlightColor.B);
            Color color               = Color.FromArgb(0x30, highlightColor.R, highlightColor.G, highlightColor.B);
            LinearGradientBrush brush = new LinearGradientBrush(startColor, startColor, 90);

            brush.GradientStops.Add(new GradientStop(color, 0.5));
            _selectionBrush        = brush;
            _selectionPen          = new Pen(SystemColors.HighlightBrush, 1);
            _selectionPen.LineJoin = PenLineJoin.Round;
            if (_selectionBrush.CanFreeze)
            {
                _selectionBrush.Freeze();
            }
            if (_selectionPen.CanFreeze)
            {
                _selectionPen.Freeze();
            }
            _editorView.LayoutChanged += new EventHandler <TextViewLayoutChangedEventArgs>(this.TextView_LayoutChanged);
            this.SelectionChanged     += this.SelectionLayer_SelectionChanged;
        }
Example #2
0
        public ImeHighlight(EditorView editorView)
        {
            _editorView   = editorView;
            _editorHelper = new SourceEditorViewHelper(_editorView);
            Color highlightColor = SystemColors.HighlightColor;
            Color color          = Color.FromArgb(0x60, highlightColor.R, highlightColor.G, highlightColor.B);
            Color color3         = Color.FromArgb(180, (Byte)(highlightColor.R / 3), (Byte)(highlightColor.G / 3), (Byte)(highlightColor.B / 3));

            _baseBrush       = new SolidColorBrush(color);
            _blinkBrush      = new SolidColorBrush(color3);
            _provisionalSpan = null;
            Int32 caretBlinkTime = User32.GetCaretBlinkTime();

            if (caretBlinkTime > 0)
            {
                _blinkTimer           = new Timer((Double)caretBlinkTime);
                _blinkTimer.AutoReset = true;
            }
            base.Visibility        = Visibility.Hidden;
            base.IsVisibleChanged += new DependencyPropertyChangedEventHandler(this.OnThisVisibilityChanged);
        }