internal void CalculateHilight(TextBlockPlusHilight hilight) { Thickness m = new Thickness(); string temp; if (hilight.Start >= 0) { temp = Text; _element.Text = temp.Substring(0, hilight.Start); m.Left = _element.ActualWidth; hilight.Element.Margin = m; _element.Text = temp.Substring(hilight.Start, hilight.Length); hilight.Element.Width = _element.ActualWidth; hilight.Element.Height = 1; Text = temp; } }
public void AddHilight(TextBlockPlusHilight hilight) { hilight.Element = new Rectangle(); hilight.Element.Height = 1; hilight.Element.HorizontalAlignment = HorizontalAlignment.Left; hilight.Element.VerticalAlignment = VerticalAlignment.Bottom; _hilights.Add(hilight); CalculateHilight(hilight); hilight.Element.StrokeThickness = 1; hilight.Element.StrokeDashCap = PenLineCap.Square; hilight.Element.StrokeDashArray = new DoubleCollection() { 0, 3 }; hilight.Element.StrokeDashOffset = 1; hilight.Element.Stroke = hilight.Brush; Children.Add(hilight.Element); }
public void ClearHilight(TextBlockPlusHilight hilight) { Children.Remove(hilight.Element); _hilights.Remove(hilight); }