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


C# TextArea.EndUpdate方法代码示例

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


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

示例1: Generate

		/// <summary>
		/// Inserts the PInvoke signature at the current cursor position.
		/// </summary>
		/// <param name="textArea">The text editor.</param>
		/// <param name="signature">A PInvoke signature string.</param>
		public void Generate(TextArea textArea, string signature)
		{
			IndentStyle oldIndentStyle = textArea.TextEditorProperties.IndentStyle;
			bool oldEnableEndConstructs = PropertyService.Get("VBBinding.TextEditor.EnableEndConstructs", true);

			try {

				textArea.BeginUpdate();
				textArea.Document.UndoStack.StartUndoGroup();
				textArea.TextEditorProperties.IndentStyle = IndentStyle.Smart;
				PropertyService.Set("VBBinding.TextEditor.EnableEndConstructs", false);

				string[] lines = signature.Replace("\r\n", "\n").Split('\n');
				
				for (int i = 0; i < lines.Length; ++i) {
					
					textArea.InsertString(lines[i]);
					
					// Insert new line if not the last line.
					if ( i < (lines.Length - 1))
					{
						Return(textArea);
					}
				}
				
			} finally {
				textArea.Document.UndoStack.EndUndoGroup();
				textArea.TextEditorProperties.IndentStyle = oldIndentStyle;
				PropertyService.Set("VBBinding.TextEditor.EnableEndConstructs", oldEnableEndConstructs);
				textArea.EndUpdate();
				textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea));
				textArea.Document.CommitUpdate();	
			}
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:39,代码来源:PInvokeCodeGenerator.cs

示例2: InsertString

        /// <summary>
        /// Insert a string of text into the specified text area at the current
        /// cursor location.
        /// </summary>
        /// <param name="textArea">The text area to use</param>
        /// <param name="text">The text to insert</param>
        public static void InsertString(TextArea textArea, string text)
        {
            int offset = textArea.Caret.Offset;

            textArea.BeginUpdate();

            try
            {
                textArea.Document.UndoStack.StartUndoGroup();

                // If inserted in a selection, replace the selection.
                // Otherwise, clear it.
                if(textArea.SelectionManager.HasSomethingSelected)
                    if(textArea.SelectionManager.SelectionCollection[0].ContainsOffset(offset))
                    {
                        offset = textArea.SelectionManager.SelectionCollection[0].Offset;
                        textArea.SelectionManager.RemoveSelectedText();
                    }
                    else
                        textArea.SelectionManager.ClearSelection();

                textArea.Document.Insert(offset, text);
                textArea.Caret.Position = textArea.Document.OffsetToPosition(offset + text.Length);
                textArea.Refresh();
                textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.WholeTextArea));
            }
            finally
            {
                textArea.Document.UndoStack.EndUndoGroup();
                textArea.EndUpdate();
            }
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:38,代码来源:ContentEditorControl.cs

示例3: Highlight

        public static void Highlight(TextArea textArea)
        {
            try
            {

                int beg_off = -1;
                int end_off = -1;
                List<TextMarker> marks = markers[textArea] as List<TextMarker>;
                if (marks == null)
                {
                    marks = new List<TextMarker>();
                    markers[textArea] = marks;
                }
                RemoveMarkers(textArea);
                string word = GetWordAtOffset(textArea, out beg_off, out end_off);
                if (string.Compare(word, "begin", true) == 0 || highlighted_keywords[word] != null)
                {
                    TmpPos end_pos = GetPositionOfEnd(textArea, end_off);
                    if (end_pos != null)
                    {
                        TextLocation Beg = textArea.Document.OffsetToPosition(beg_off);
                        TextLocation End = textArea.Document.OffsetToPosition(end_off);
                        TextMarker marker = new TextMarker(beg_off, word.Length, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204));
                        marker.WholeLine = false;
                        textArea.Document.MarkerStrategy.AddMarker(marker);
                        marks.Add(marker);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(beg_off)));
                        textArea.EndUpdate();
                        Beg = textArea.Document.OffsetToPosition(end_pos.start_pos);
                        End = textArea.Document.OffsetToPosition(end_pos.start_pos + end_pos.len);
                        marker = new TextMarker(end_pos.start_pos, end_pos.len, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204));
                        marker.WholeLine = false;
                        textArea.Document.MarkerStrategy.AddMarker(marker);
                        marks.Add(marker);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(end_pos.start_pos)));
                        textArea.EndUpdate();
                        textArea.Document.CommitUpdate();
                    }
                }
                else if (string.Compare(word, "end", true) == 0)
                {
                    TmpPos beg_pos = GetPositionOfBegin(textArea, beg_off);
                    if (beg_pos != null)
                    {
                        TextLocation Beg = textArea.Document.OffsetToPosition(beg_off);
                        TextLocation End = textArea.Document.OffsetToPosition(end_off);
                        TextMarker marker = new TextMarker(beg_off, 3, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204));
                        marker.WholeLine = false;
                        textArea.Document.MarkerStrategy.AddMarker(marker);
                        marks.Add(marker);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(beg_off)));
                        textArea.EndUpdate();
                        Beg = textArea.Document.OffsetToPosition(beg_pos.start_pos);
                        End = textArea.Document.OffsetToPosition(beg_pos.start_pos + beg_pos.len);
                        marker = new TextMarker(beg_pos.start_pos, beg_pos.len, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204));
                        marker.WholeLine = false;
                        textArea.Document.MarkerStrategy.AddMarker(marker);
                        marks.Add(marker);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(beg_pos.start_pos)));
                        textArea.EndUpdate();
                        textArea.Document.CommitUpdate();
                    }
                }
            }
            catch (Exception e)
            {

            }
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:69,代码来源:CodeCompletionHighlighter.cs

示例4: RemoveMarkers

        private static void RemoveMarkers(TextArea textArea)
        {
            //textArea.Document.MarkerStrategy.RemoveAll(remove_pred);
            List<TextMarker> marks = markers[textArea] as List<TextMarker>;
            if (marks != null)
            {
                foreach (TextMarker marker in marks)
                {
                    try
                    {
                        textArea.Document.MarkerStrategy.RemoveMarker(marker);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(marker.Offset)));
                        textArea.EndUpdate();
                    }
                    catch
                    {

                    }
                }
                marks.Clear();
            }
            textArea.Document.CommitUpdate();
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:23,代码来源:CodeCompletionHighlighter.cs


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