private void UpdateCaret() { Int32 textInsertionIndex = this.Position.TextInsertionIndex; ITextLine textLineContaining = _textViewHelper.GetTextLineContaining(textInsertionIndex); if (textLineContaining == null) { base.Height = 0; if ((_editorView.TextLines.Count == 0) || (textInsertionIndex < _editorView.TextLines[0].LineSpan.Start)) { Canvas.SetTop(this, 0); } else { Canvas.SetTop(this, _editorView.ViewportHeight); } Canvas.SetLeft(this, 0); } else { Canvas.SetTop(this, textLineContaining.VerticalOffset); base.Height = textLineContaining.Height; Genetibase.Windows.Controls.Editor.Text.View.TextBounds characterBounds = textLineContaining.GetCharacterBounds(this.Position.CharacterIndex); if (!_overwriteMode) { if (this.Placement == CaretPlacement.LeftOfCharacter) { Canvas.SetLeft(this, characterBounds.Left); } else { Canvas.SetLeft(this, characterBounds.Right); } } else if (characterBounds.Right > characterBounds.Left) { base.Width = characterBounds.Right - characterBounds.Left; Canvas.SetLeft(this, characterBounds.Left); } else if (characterBounds.Left > characterBounds.Right) { base.Width = characterBounds.Left - characterBounds.Right; Canvas.SetLeft(this, characterBounds.Right); } else { base.Width = _defaultOverwriteCaretWidth; Canvas.SetLeft(this, characterBounds.Left); } _blinkAnimationClock.Controller.Begin(); } base.InvalidateVisual(); }
/// <summary> /// Indicates whether this instance and a specified Object are equal. /// </summary> /// <param name="obj">Another Object to compare to.</param> /// <returns> /// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false. /// </returns> public override Boolean Equals(Object obj) { if ((obj != null) && (obj is TextBounds)) { TextBounds bounds = (TextBounds)obj; if (((bounds.Left == this.Left) && (bounds.Width == this.Width)) && (bounds.Top == this.Top)) { return(bounds.Height == this.Height); } } return(false); }