当前位置: 首页>>代码示例>>C#>>正文


C# ITrackingPoint.GetPoint方法代码示例

本文整理汇总了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);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:10,代码来源:IntellisenseSessionHelper.cs

示例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];
        }
开发者ID:chandramouleswaran,项目名称:LangSvcV2,代码行数:38,代码来源:Antlr4IntellisenseController.cs

示例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);
        }
开发者ID:xps,项目名称:MultiEdit,代码行数:32,代码来源:MultiPointEditCommandFilter.cs

示例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);
        }
开发者ID:Matt-17,项目名称:MultiEdit,代码行数:25,代码来源:MultiPointEditCommandFilter.cs

示例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);
            }

        }
开发者ID:adiarbel,项目名称:Co-Programmer,代码行数:31,代码来源:CoProCommandFilter.cs


注:本文中的ITrackingPoint.GetPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。