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


C# VisualLine.GetTextLine方法代码示例

本文整理汇总了C#中ICSharpCode.AvalonEdit.Rendering.VisualLine.GetTextLine方法的典型用法代码示例。如果您正苦于以下问题:C# VisualLine.GetTextLine方法的具体用法?C# VisualLine.GetTextLine怎么用?C# VisualLine.GetTextLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.AvalonEdit.Rendering.VisualLine的用法示例。


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

示例1: CalcCaretRectangle

        Rect CalcCaretRectangle(VisualLine visualLine)
        {
            if (!visualColumnValid) {
                RevalidateVisualColumn(visualLine);
            }

            TextLine textLine = visualLine.GetTextLine(position.VisualColumn);
            double xPos = visualLine.GetTextLineVisualXPosition(textLine, position.VisualColumn);
            double lineTop = visualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextTop);
            double lineBottom = visualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.LineBottom);

            return new Rect(xPos,
                            lineTop,
                            SystemParameters.CaretWidth,
                            lineBottom - lineTop);
        }
开发者ID:hardliner66,项目名称:ATMELGitSCC,代码行数:16,代码来源:Caret.cs

示例2: CalcCaretOverstrikeRectangle

		Rect CalcCaretOverstrikeRectangle(VisualLine visualLine)
		{
			if (!visualColumnValid) {
				RevalidateVisualColumn(visualLine);
			}
			
			int currentPos = position.VisualColumn;
			// The text being overwritten in overstrike mode is everything up to the next normal caret stop
			int nextPos = visualLine.GetNextCaretPosition(currentPos, LogicalDirection.Forward, CaretPositioningMode.Normal, true);
			TextLine textLine = visualLine.GetTextLine(currentPos);
			
			Rect r;
			if (currentPos < visualLine.VisualLength) {
				// If the caret is within the text, use GetTextBounds() for the text being overwritten.
				// This is necessary to ensure the rectangle is calculated correctly in bidirectional text.
				var textBounds = textLine.GetTextBounds(currentPos, nextPos - currentPos)[0];
				r = textBounds.Rectangle;
				r.Y += visualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.LineTop);
			} else {
				// If the caret is at the end of the line (or in virtual space),
				// use the visual X position of currentPos and nextPos (one or more of which will be in virtual space)
				double xPos = visualLine.GetTextLineVisualXPosition(textLine, currentPos);
				double xPos2 = visualLine.GetTextLineVisualXPosition(textLine, nextPos);
				double lineTop = visualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextTop);
				double lineBottom = visualLine.GetTextLineVisualYPosition(textLine, VisualYPosition.TextBottom);
				r = new Rect(xPos, lineTop, xPos2 - xPos, lineBottom - lineTop);
			}
			// If the caret is too small (e.g. in front of zero-width character), ensure it's still visible
			if (r.Width < SystemParameters.CaretWidth)
				r.Width = SystemParameters.CaretWidth;
			return r;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:32,代码来源:Caret.cs


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