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


C# ITextDocument.InsertText方法代码示例

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


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

示例1: InsertNewLine

		public void InsertNewLine (ITextDocument editor, NewLineInsertion insertion, ref int offset)
		{
			string str = null;
			switch (insertion) {
			case NewLineInsertion.Eol:
				str = editor.GetEolMarker ();
				break;
			case NewLineInsertion.BlankLine:
				str = editor.GetEolMarker () + editor.GetEolMarker ();
				break;
			default:
				return;
		}

			editor.InsertText (offset, str);
			offset += str.Length;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:17,代码来源:InsertionPoint.cs

示例2: IndentCode

		static void IndentCode (ITextDocument data, string lineIndent)
		{
			for (int i = 1; i < data.LineCount; i++) {
				var line = data.GetLine (i + 1);
				if (line.Length > 0)
					data.InsertText (line.Offset, lineIndent);
			}
		}
开发者ID:ZZHGit,项目名称:monodevelop,代码行数:8,代码来源:CodeTemplate.cs

示例3: Insert

		public int Insert (ITextDocument editor, string text)
		{
			int offset = editor.LocationToOffset (Location);
			using (var undo = editor.OpenUndoGroup ()) {

				// TODO: Run formatter !!!
				// text = editor.FormatString (Location, text);

				var line = editor.GetLineByOffset (offset);
				int insertionOffset = line.Offset + Location.Column - 1;
				offset = insertionOffset;
				InsertNewLine (editor, LineBefore, ref offset);
				int result = offset - insertionOffset;

				editor.InsertText (offset, text);
				offset += text.Length;
				InsertNewLine (editor, LineAfter, ref offset);
				return result;
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:20,代码来源:InsertionPoint.cs


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