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


C# TextViewPosition类代码示例

本文整理汇总了C#中TextViewPosition的典型用法代码示例。如果您正苦于以下问题:C# TextViewPosition类的具体用法?C# TextViewPosition怎么用?C# TextViewPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TextViewPosition类属于命名空间,在下文中一共展示了TextViewPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EditorPositionState

 public EditorPositionState(double verticalOffset, double horizontalOffset, TextViewPosition textViewPosition, double DesiredXPos)
 {
     this.VerticalOffset = verticalOffset;
     this.HorizontalOffset = horizontalOffset;
     this.TextViewPosition = textViewPosition;
     this.DesiredXPos = DesiredXPos;
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:7,代码来源:EditorPositionState.cs

示例2: StartSelectionOrSetEndpoint

		public override Selection StartSelectionOrSetEndpoint(TextViewPosition startPosition, TextViewPosition endPosition)
		{
			var document = textArea.Document;
			if (document == null)
				throw ThrowUtil.NoDocumentAssigned();
			return Create(textArea, startPosition, endPosition);
		}
开发者ID:AkshayVats,项目名称:SuperShell,代码行数:7,代码来源:EmptySelection.cs

示例3: SimpleSelection

		/// <summary>
		/// Creates a new SimpleSelection instance.
		/// </summary>
		internal SimpleSelection(TextArea textArea, TextViewPosition start, TextViewPosition end)
			: base(textArea)
		{
			this.start = start;
			this.end = end;
			this.startOffset = textArea.Document.GetOffset(start.Location);
			this.endOffset = textArea.Document.GetOffset(end.Location);
		}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:11,代码来源:SimpleSelection.cs

示例4: GetXPos

		static double GetXPos(TextArea textArea, TextViewPosition pos)
		{
			DocumentLine documentLine = textArea.Document.GetLineByNumber(pos.Line);
			VisualLine visualLine = textArea.TextView.GetOrConstructVisualLine(documentLine);
			int vc = visualLine.ValidateVisualColumn(pos, true);
			TextLine textLine = visualLine.GetTextLine(vc);
			return visualLine.GetTextLineVisualXPosition(textLine, vc);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:8,代码来源:RectangleSelection.cs

示例5: Create

		internal static Selection Create(TextArea textArea, TextViewPosition start, TextViewPosition end)
		{
			if (textArea == null)
				throw new ArgumentNullException("textArea");
			if (textArea.Document.GetOffset(start.Location) == textArea.Document.GetOffset(end.Location) && start.VisualColumn == end.VisualColumn)
				return textArea.emptySelection;
			else
				return new SimpleSelection(textArea, start, end);
		}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:9,代码来源:Selection.cs

示例6: Caret

        internal Caret(TextArea textArea)
        {
            this.textArea = textArea;
            this.textView = textArea.TextView;
            position = new TextViewPosition(1, 1, 0);

            caretAdorner = new CaretLayer(textView);
            textView.InsertLayer(caretAdorner, KnownLayer.Caret, LayerInsertionPosition.Replace);
            textView.VisualLinesChanged += TextView_VisualLinesChanged;
            textView.ScrollOffsetChanged += TextView_ScrollOffsetChanged;
        }
开发者ID:hardliner66,项目名称:ATMELGitSCC,代码行数:11,代码来源:Caret.cs

示例7: RectangleSelection

 RectangleSelection(TextArea textArea, int startLine, double startXPos, TextViewPosition end)
     : base(textArea)
 {
     InitDocument();
     this.startLine = startLine;
     endLine = end.Line;
     this.startXPos = startXPos;
     endXPos = GetXPos(textArea, end);
     CalculateSegments();
     topLeftOffset = segments.First().StartOffset;
     bottomRightOffset = segments.Last().EndOffset;
 }
开发者ID:arkanoid1,项目名称:Yanitta,代码行数:12,代码来源:RectangleSelection.cs

示例8: GetOffsetForLinesInSegmentOnScreen

        private static IEnumerable<Tuple<int, int>> GetOffsetForLinesInSegmentOnScreen(TextView textView, ISegment segment,
            bool extendToFullWidthAtLineEnd = false)
        {
            var segmentStart = segment.Offset;
            var segmentEnd = segment.Offset + segment.Length;

            if (segmentStart > textView.TextDocument.TextLength)
            {
                segmentStart = textView.TextDocument.TextLength;
            }

            if (segmentEnd > textView.TextDocument.TextLength)
            {
                segmentEnd = textView.TextDocument.TextLength;
            }

            var start = new TextViewPosition(textView.TextDocument.GetLocation(segmentStart));
            var end = new TextViewPosition(textView.TextDocument.GetLocation(segmentEnd));

            foreach (var line in textView.VisualLines)
            {
                if (!line.DocumentLine.IsDeleted)
                {
                    if (line.Offset > segmentEnd)
                    {
                        break;
                    }

                    if (line.EndOffset < segmentStart)
                    {
                        continue;
                    }

                    // find start and begining in current line.
                    var lineStartOffset = line.Offset;

                    if (segment.Offset > line.Offset)
                    {
                        lineStartOffset = line.Offset + (segment.Offset - line.Offset);
                    }

                    var lineEndOffset = line.EndOffset;

                    if (segment.EndOffset < line.EndOffset)
                    {
                        lineEndOffset = line.EndOffset - (line.EndOffset - segment.EndOffset);
                    }

                    // generate rect for section in this line.
                    yield return new Tuple<int, int>(lineStartOffset, lineEndOffset);
                }
            }
        }
开发者ID:VitalElement,项目名称:AvalonStudio,代码行数:53,代码来源:VisualLineGeometryBuilder.cs

示例9: RectangleSelection

 private RectangleSelection(TextArea textArea, TextViewPosition start, int endLine, double endXPos)
     : base(textArea)
 {
     InitDocument();
     this.startLine = start.Line;
     this.endLine = endLine;
     this.startXPos = GetXPos(textArea, start);
     this.endXPos = endXPos;
     CalculateSegments();
     this.topLeftOffset = this.segments.First().StartOffset;
     this.bottomRightOffset = this.segments.Last().EndOffset;
 }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:12,代码来源:RectangleSelection.cs

示例10: GetViewPortPosition

        public static Rect GetViewPortPosition(TextView textView, int offset)
        {
            var position = new TextViewPosition(textView.GetLocation(offset));

            if (position.Line > 0)
            {
                return GetTextPositionInViewPort(textView, position);
            }
            else
            {
                return new Rect();
            }
        }
开发者ID:VitalElement,项目名称:AvalonStudio,代码行数:13,代码来源:VisualLineGeometryBuilder.cs

示例11: GetWordUnderMouse

        public static string GetWordUnderMouse(this TextDocument document, TextViewPosition position)
        {
            string wordHovered = string.Empty;

            var line = position.Line;
            var column = position.Column;

            var offset = document.GetOffset(line, column);
            if (offset >= document.TextLength)
                offset--;

            var textAtOffset = document.GetText(offset, 1);

            // Get text backward of the mouse position, until the first space
            while (!string.IsNullOrWhiteSpace(textAtOffset))
            {
                wordHovered = textAtOffset + wordHovered;

                offset--;

                if (offset < 0)
                    break;

                textAtOffset = document.GetText(offset, 1);
            }

            // Get text forward the mouse position, until the first space
            offset = document.GetOffset(line, column);
            if (offset < document.TextLength - 1)
            {
                offset++;

                textAtOffset = document.GetText(offset, 1);

                while (!string.IsNullOrWhiteSpace(textAtOffset))
                {
                    wordHovered = wordHovered + textAtOffset;

                    offset++;

                    if (offset >= document.TextLength)
                        break;

                    textAtOffset = document.GetText(offset, 1);
                }
            }

            return wordHovered;
        }
开发者ID:CadeLaRen,项目名称:digiCamControl,代码行数:49,代码来源:AvalonEditExtensions.cs

示例12: GetTextPositionInViewPort

        public static Rect GetTextPositionInViewPort(TextView textView, TextViewPosition position)
        {
            if (position.Line - 1 < textView.VisualLines.Count)
            {
                return new Rect(textView.VisualLines[position.Line - 1].RenderedText.HitTestTextPosition(position.Column - 1).X + textView.TextSurfaceBounds.X,
                    textView.CharSize.Height * (position.Line - 1),
                    textView.CharSize.Width,
                    textView.CharSize.Height);
            }

            return new Rect(textView.TextSurfaceBounds.X + textView.CharSize.Width * (position.Column - 1),
                textView.CharSize.Height * (position.Line - 1),
                textView.CharSize.Width,
                textView.CharSize.Height);
        }
开发者ID:VitalElement,项目名称:AvalonStudio,代码行数:15,代码来源:VisualLineGeometryBuilder.cs

示例13: AddSpacesIfRequired

		internal string AddSpacesIfRequired(string newText, TextViewPosition start, TextViewPosition end)
		{
			if (EnableVirtualSpace && InsertVirtualSpaces(newText, start, end)) {
				var line = textArea.Document.GetLineByNumber(start.Line);
				string lineText = textArea.Document.GetText(line);
				var vLine = textArea.TextView.GetOrConstructVisualLine(line);
				int colDiff = start.VisualColumn - vLine.VisualLengthWithEndOfLineMarker;
				if (colDiff > 0) {
					string additionalSpaces = "";
					if (!textArea.Options.ConvertTabsToSpaces && lineText.Trim('\t').Length == 0) {
						int tabCount = (int)(colDiff / textArea.Options.IndentationSize);
						additionalSpaces = new string('\t', tabCount);
						colDiff -= tabCount * textArea.Options.IndentationSize;
					}
					additionalSpaces += new string(' ', colDiff);
					return additionalSpaces + newText;
				}
			}
			return newText;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:20,代码来源:Selection.cs

示例14: GetWordUnderMouse

        public static string GetWordUnderMouse(this TextDocument document, TextViewPosition position, bool cancelDot)
        {
            string wordHovered = string.Empty;
            int line = position.Line;
            int column = position.Column;
            int offset = document.GetOffset(line, column);
            if (offset >= document.TextLength)
                offset--;
            string textAtOffset = document.GetText(offset, 1);

            // Get text backward of the mouse position, until the first space
            while (!string.IsNullOrWhiteSpace(textAtOffset) && !StringContainsBreaks(textAtOffset, true))
            {
                wordHovered = textAtOffset + wordHovered;
                offset--;
                if (offset < 0)
                    break;
                textAtOffset = document.GetText(offset, 1);
            }

            // Get text forward the mouse position, until the first space
            offset = document.GetOffset(line, column);
            if (offset < document.TextLength - 1) {
                offset++;

                textAtOffset = document.GetText(offset, 1);
                while (!string.IsNullOrWhiteSpace(textAtOffset) && !StringContainsBreaks(textAtOffset, false)) {
                    wordHovered = wordHovered + textAtOffset;
                    offset++;
                    if (offset >= document.TextLength)
                        break;
                    textAtOffset = document.GetText(offset, 1);
                }
            }
            return wordHovered;
        }
开发者ID:nonconforme,项目名称:UrhoAngelscriptIDE,代码行数:36,代码来源:AvalonExtensions.cs

示例15: InsertVirtualSpaces

 bool InsertVirtualSpaces(string newText, TextViewPosition start, TextViewPosition end)
 {
     return (!string.IsNullOrEmpty(newText) || !(IsInVirtualSpace(start) && IsInVirtualSpace(end)))
         && newText != "\r\n"
         && newText != "\n"
         && newText != "\r";
 }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:7,代码来源:Selection.cs


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