本文整理汇总了C#中ITrackingPoint.GetPoint方法的典型用法代码示例。如果您正苦于以下问题:C# ITrackingPoint.GetPoint方法的具体用法?C# ITrackingPoint.GetPoint怎么用?C# ITrackingPoint.GetPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITrackingPoint
的用法示例。
在下文中一共展示了ITrackingPoint.GetPoint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTriggerPoint
public static SnapshotPoint? GetTriggerPoint(ITextView textView, ITrackingPoint triggerPoint, ITextSnapshot textSnapshot) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
if (triggerPoint == null)
throw new ArgumentNullException(nameof(triggerPoint));
if (textSnapshot == null)
throw new ArgumentNullException(nameof(textSnapshot));
return triggerPoint.GetPoint(textView.TextSnapshot);
}
示例2: GoToSourceImpl
public override IEnumerable<INavigateToTarget> GoToSourceImpl(VSOBJGOTOSRCTYPE gotoSourceType, ITrackingPoint triggerPoint)
{
if (triggerPoint == null)
return new INavigateToTarget[0];
ITextSnapshot currentSnapshot = triggerPoint.TextBuffer.CurrentSnapshot;
SnapshotPoint point = triggerPoint.GetPoint(currentSnapshot);
foreach (var span in this.ClassificationTagAggregator.GetTags(new SnapshotSpan(point, point)))
{
if (!span.Tag.ClassificationType.IsOfType(AntlrClassificationTypeNames.LexerRule)
&& !span.Tag.ClassificationType.IsOfType(AntlrClassificationTypeNames.ParserRule))
{
continue;
}
NormalizedSnapshotSpanCollection spans = span.Span.GetSpans(currentSnapshot);
if (spans.Count == 1)
{
SnapshotSpan span2 = spans[0];
SnapshotSpan span3 = span.Span.GetSpans(span.Span.AnchorBuffer)[0];
if (span2.Length == span3.Length)
{
SnapshotSpan span4 = spans[0];
if (span4.Contains(point))
{
string ruleName = span2.GetText();
var rules = BackgroundParser.RuleSpans;
KeyValuePair<ITrackingSpan, ITrackingPoint> value;
if (rules != null && rules.TryGetValue(ruleName, out value))
return new INavigateToTarget[] { new SnapshotSpanNavigateToTarget(TextView, new SnapshotSpan(value.Value.GetPoint(currentSnapshot), value.Value.GetPoint(currentSnapshot))) };
}
}
}
}
return new INavigateToTarget[0];
}
示例3: DrawSingleSyncPoint
private void DrawSingleSyncPoint(ITrackingPoint trackPoint)
{
var position = trackPoint.GetPosition(m_textView.TextSnapshot);
if (position > m_textView.TextSnapshot.Length)
return;
var point = trackPoint.GetPoint(m_textView.TextSnapshot);
if (position == m_textView.TextSnapshot.Length)
point -= 1;
var span = new SnapshotSpan(point, 1);
var brush = Brushes.DarkGray;
var geom = m_textView.TextViewLines.GetLineMarkerGeometry(span);
var drawing = new GeometryDrawing(brush, null, geom);
if (drawing.Bounds.IsEmpty)
return;
Rectangle rect = new Rectangle()
{
Fill = brush,
Width = drawing.Bounds.Width / 6,
Height = drawing.Bounds.Height - 4,
Margin = new System.Windows.Thickness(0, 2, 0, 0)
};
Canvas.SetLeft(rect, position == m_textView.TextSnapshot.Length ? geom.Bounds.Right : geom.Bounds.Left);
Canvas.SetTop(rect, geom.Bounds.Top);
m_adornmentLayer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, "MultiEditLayer", rect, null);
}
示例4: DrawSingleSyncPoint
private void DrawSingleSyncPoint(ITrackingPoint trackPoint)
{
if (trackPoint.GetPosition(m_textView.TextSnapshot) >= m_textView.TextSnapshot.Length)
return;
SnapshotSpan span = new SnapshotSpan(trackPoint.GetPoint(m_textView.TextSnapshot), 1);
var brush = Brushes.DarkGray;
var geom = m_textView.TextViewLines.GetMarkerGeometry(span);
GeometryDrawing drawing = new GeometryDrawing(brush, null, geom);
if (drawing.Bounds.IsEmpty)
return;
Rectangle rect = new Rectangle()
{
Fill = brush,
Width = 1,
Height = drawing.Bounds.Height - 1,
Margin = new Thickness(),
};
Canvas.SetLeft(rect, geom.Bounds.Left);
Canvas.SetTop(rect, geom.Bounds.Top);
m_adornmentLayer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, "MultiEditLayer", rect, null);
}
示例5: DrawSingleSyncPoint
/// <summary>
/// Draw a caret in its position
/// </summary>
/// <param name="curTrackPoint"></param>
/// <param name="brush"></param>
private void DrawSingleSyncPoint(ITrackingPoint curTrackPoint, SolidColorBrush brush)
{
SnapshotSpan span;
SnapshotPoint tempSnapPoint = curTrackPoint.GetPoint(m_textView.TextSnapshot);
if (tempSnapPoint.Position != m_textView.TextSnapshot.Length)
{
//m_textView.TextSnapshot.TextBuffer.Insert(tempSnapPoint.Position, " ");
//tempSnapPoint = tempSnapPoint.Subtract(1);
span = new SnapshotSpan(tempSnapPoint, 1);
var g = m_textView.TextViewLines.GetLineMarkerGeometry(span);
GeometryDrawing drawing = new GeometryDrawing(brush, null, g);
if (drawing.Bounds.IsEmpty)
return;
System.Windows.Shapes.Rectangle r = new System.Windows.Shapes.Rectangle()
{
Fill = brush,
Width = drawing.Bounds.Width / 4,
Height = drawing.Bounds.Height
};
Canvas.SetLeft(r, g.Bounds.Left);
Canvas.SetTop(r, g.Bounds.Top);
m_adornmentLayer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, "MultiEditLayer", r, null);
}
}