• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AvalonEdit.TextEditor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AvalonEditTextContainer

        public AvalonEditTextContainer(TextEditor editor)
        {
            _editor = editor;
            _currentText = SourceText.From(_editor.Text);

            _editor.Document.Changed += DocumentOnChanged;
        }
开发者ID:mjheitland,项目名称:TableTweaker,代码行数:7,代码来源:AvalonEditTextContainer.cs


示例2: MainViewContent

        public MainViewContent(string fileName, IWorkbenchWindow workbenchWindow)
        {
            codeEditor = new CodeEditor();

            textEditor = new TextEditor();
            textEditor.FontFamily = new FontFamily("Consolas");

            textEditor.TextArea.TextEntering += TextAreaOnTextEntering;
            textEditor.TextArea.TextEntered += TextAreaOnTextEntered;
            textEditor.ShowLineNumbers = true;

            var ctrlSpace = new RoutedCommand();
            ctrlSpace.InputGestures.Add(new KeyGesture(Key.Space, ModifierKeys.Control));
            var cb = new CommandBinding(ctrlSpace, OnCtrlSpaceCommand);
            // this.CommandBindings.Add(cb);

            adapter = new SharpSnippetTextEditorAdapter(textEditor);
            this.WorkbenchWindow = workbenchWindow;
            textEditor.TextArea.TextView.Services.AddService(typeof (ITextEditor), adapter);
            LoadFile(fileName);

            iconBarManager = new IconBarManager();
            textEditor.TextArea.LeftMargins.Insert(0, new IconBarMargin(iconBarManager));

            var textMarkerService = new TextMarkerService(textEditor.Document);
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            textEditor.TextArea.TextView.Services.AddService(typeof (ITextMarkerService), textMarkerService);
            textEditor.TextArea.TextView.Services.AddService(typeof (IBookmarkMargin), iconBarManager);
        }
开发者ID:sentientpc,项目名称:SharpSnippetCompiler-v5,代码行数:30,代码来源:MainViewContent.cs


示例3: GoToLineDialog

 public GoToLineDialog(TextEditor textEditor) {
   InitializeComponent();
   this.textEditor = textEditor;
   lowerLimit = 1;
   upperLimit = textEditor.LineCount;
   lineNumberLabel.Text = string.Format("Line Number ({0}-{1}):", lowerLimit, upperLimit);
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:7,代码来源:GoToLineDialog.cs


示例4: Processe

 /// <summary>
 ///     取得配置后的处理工厂对象
 /// </summary>
 /// <param name="serviceType">指定为哪类服务器类型配置消息处理工厂</param>
 /// <returns></returns>
 public static void Processe(TextEditor rtb, EMark mark)
 {
     if (_procs.ContainsKey(mark))
     {
         _procs[mark].Process(rtb, mark);
     }
 }
开发者ID:dodola,项目名称:MEditor,代码行数:12,代码来源:ProcesserFactory.cs


示例5: FindTextInTextEditor

        public int FindTextInTextEditor(TextEditor te, int ofst, string whatfind, ref int cor)
        {

            if (ofst < 0) return -1;
            string searchtext = whatfind;
            if (cbMatchCase.IsChecked == false) searchtext = searchtext.ToLower();                        
            int lenst = searchtext.Length;
            string tetext = "";
            {
                while (true)
                {
                    if (ofst < 0) return -1;
                    
                    if (cbFindUp.IsChecked == false)
                    { if (ofst + lenst > te.Document.TextLength) { return -2; } }
                    else
                    {
                        if (ofst < 0) { return -1; }
                        if (ofst > te.Document.TextLength - lenst) ofst = ofst - lenst;
                    }
                    tetext = te.Document.GetText(ofst, lenst);                                        
                    if (cbMatchCase.IsChecked == false) tetext = tetext.ToLower();                    
                    if (searchtext == tetext)
                    {
                        cor = tetext.Length;
                        return ofst;
                    }
                    if (cbFindUp.IsChecked == false) ofst++; else ofst--;
                }
            }
        }//func        
开发者ID:NightmareX1337,项目名称:lfs,代码行数:31,代码来源:00wFind.xaml.cs


示例6: CurrentLineHighlightRenderer

        public CurrentLineHighlightRenderer(TextEditor editor, ProjectItemCodeDocument projectitem)
        {
            _editor = editor;
            _projectitem = projectitem;

            _editor.TextArea.Caret.PositionChanged += (s, e) => Invalidate();
        }
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:7,代码来源:CurrentLineHighlightRenderer.cs


示例7: CodeControl

        /// <summary>
        /// Initializes a new instance of class CodeControl
        /// </summary>
        /// <param name="content">Base64 content of the web resource</param>
        /// <param name="type">Web resource type</param>
        public CodeControl(string content, Enumerations.WebResourceType type)
        {
            InitializeComponent();

            textEditor = new TextEditor
            {
                ShowLineNumbers = true,
                FontSize = 12,
                FontFamily = new System.Windows.Media.FontFamily("Consolas"),
                //Focusable = true,
                //IsHitTestVisible = true
            };

            var wpfHost = new ElementHost
            {
                Child = textEditor,
                Dock = DockStyle.Fill,
                BackColorTransparent = true,
            };

            Controls.Add(wpfHost);

            if (!string.IsNullOrEmpty(content))
            {
                // Converts base64 content to string
                byte[] b = Convert.FromBase64String(content);
                innerContent = System.Text.Encoding.UTF8.GetString(b);
                originalContent = innerContent;
                innerType = type;
            }
        }
开发者ID:KingRider,项目名称:XrmToolBox,代码行数:36,代码来源:CodeControl.cs


示例8: MainForm

        public MainForm() {
            InitializeComponent();

            // 初始化编辑器。
            codeEditor = new ICSharpCode.AvalonEdit.TextEditor();
            codeEditorHost.Child = codeEditor;

            codeEditor.FontFamily = new System.Windows.Media.FontFamily("Consolas");
            codeEditor.FontSize = 14;
            codeEditor.ShowLineNumbers = true;
            codeEditor.SyntaxHighlighting = syntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(".js");
            codeEditor.WordWrap = true;

            foldingManager = FoldingManager.Install(codeEditor.TextArea);
            codeEditor.TextChanged += codeEditor_TextChanged;

            //codeEditor.TextArea.AddHandler(System.Windows.DataObject.PastingEvent, new System.Windows.DataObjectPastingEventHandler(codeEditor_Paste));

            textMarkerService = new TextMarkerService(codeEditor);
            TextView textView = codeEditor.TextArea.TextView;
            textView.BackgroundRenderers.Add(textMarkerService);
            textView.LineTransformers.Add(textMarkerService);
            textView.Services.AddService(typeof(TextMarkerService), textMarkerService);
            textView.MouseHover += MouseHover;
            textView.MouseHoverStopped += codeEditorMouseHoverStopped;

            textView.MouseHover += MouseHover;
            textView.MouseHoverStopped += codeEditorMouseHoverStopped;
            textView.VisualLinesChanged += VisualLinesChanged;

        }
开发者ID:xuld,项目名称:JsonFormator,代码行数:31,代码来源:MainForm.cs


示例9: E2Editor

 public E2Editor()
 {
     _settings = MainWindow.Settings ?? new Settings();
     _textEditor = new TextEditor
                       {
                           SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("Expression2"),
                           Background = new SolidColorBrush(Color.FromRgb(0x1A, 0x1A, 0x1A)),
                           Foreground = new SolidColorBrush(Color.FromRgb(0xE0, 0xE0, 0xE0)),
                           FontFamily = _settings.Font,
                           ShowLineNumbers = true,
                           Options = {ConvertTabsToSpaces = true},
                       };
     if (_settings.AutoIndentEnabled)
     {
         _textEditor.TextArea.IndentationStrategy = new E2IndentationStrategy(_textEditor.Options);
         _textEditor.TextArea.TextEntered += AutoIndent_OnTextEntered;
     }
     try
     {
         using (Stream s = Resource.GetResource("E2.Functions"))
             _functionData = Function.LoadData(s);
         _textEditor.TextArea.TextView.LineTransformers.Add(new E2Colorizer(_functionData));
         _textEditor.TextArea.TextEntered += IntelliSense_OnTextEntered;
         _textEditor.TextArea.TextEntered += Insight_OnTextEntered;
     }
     catch (Exception)
     {
         if (!DesignerProperties.GetIsInDesignMode(this)) MessageBox.Show("Unable to load function data.");
         //Debugger.Break();
     }
     AddChild(_textEditor);
 }
开发者ID:itsbth,项目名称:E2Edit,代码行数:32,代码来源:E2Editor.cs


示例10: GetPositionFromOffset

        public Point GetPositionFromOffset(TextEditor editor, VisualYPosition position, int offset)
        {
            var startLocation = editor.TextArea.TextView.Document.GetLocation(offset);
            var point = editor.TextArea.TextView.GetVisualPosition(new TextViewPosition(startLocation), position);

            return new Point(Math.Round(point.X), Math.Round(point.Y));
        }
开发者ID:anaimi,项目名称:farawla,代码行数:7,代码来源:BaseRendered.cs


示例11: SetUpFixture

		public void SetUpFixture()
		{
			resourceWriter = new MockResourceWriter();
			resourceService = new MockResourceService();
			resourceService.SetResourceWriter(resourceWriter);
			
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();
			
			PythonParser parser = new PythonParser();
			ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(499, 309);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter adapter = new AvalonEditDocumentAdapter(document, null);
					MockTextEditorOptions options = new MockTextEditorOptions();
					PythonDesignerGenerator generator = new PythonDesignerGenerator(options);
					generator.Merge(host, adapter, compilationUnit, serializationManager);
				}
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:31,代码来源:MergeFormTestFixture.cs


示例12: Page

 public Page(string path, TextEditor viewer, WebBrowser webviewer) {
     Viewer = viewer;
     WebViewer = webviewer;
     Root = path;
     if (File.Exists(Root + @"\__page.cfg")) {
         try
         {
             Config = JObject.Parse(File.ReadAllText(Root + @"\__page.cfg", Encoding.UTF8));
             Title = (string) Config["title"] ?? path.Split('\\').Last();
         }catch(Exception)
         {
             Config = new JObject();
             Title = path.Split('\\').Last();
         }
     }
     else
     {
         Config = new JObject();
         Title = path.Split('\\').Last();
     }
     Childs = new List<Page>();
     Item = new TreeViewItem { Header = Title };
     Item.Selected += Click;
     foreach (var dir in Directory.EnumerateDirectories(Root)) {
         var p = new Page(dir, viewer, webviewer);
         Childs.Add(p);
         Item.Items.Add(p.Item);
     }
 }
开发者ID:averrin,项目名称:Ravenor.net,代码行数:29,代码来源:Tree.cs


示例13: AvalonEditTextEditorAdapter

		public AvalonEditTextEditorAdapter(TextEditor textEditor)
		{
			if (textEditor == null)
				throw new ArgumentNullException("textEditor");
			this.textEditor = textEditor;
			this.Options = new OptionsAdapter(textEditor.Options);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:AvalonEditTextEditorAdapter.cs


示例14: SetUpFixture

		public void SetUpFixture()
		{
			AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
			document = textEditor.Document;
			textEditor.Text = GetTextEditorCode();

			RubyParser parser = new RubyParser();
			ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text);

			using (DesignSurface designSurface = new DesignSurface(typeof(UserControl))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				UserControl userControl = (UserControl)host.RootComponent;			
				userControl.ClientSize = new Size(489, 389);
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(userControl);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(userControl, "userControl1");
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {
					AvalonEditDocumentAdapter docAdapter = new AvalonEditDocumentAdapter(document, null);
					RubyDesignerGenerator generator = new RubyDesignerGenerator(new MockTextEditorOptions());
					generator.Merge(host, docAdapter, compilationUnit, serializationManager);
				}
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:26,代码来源:NoNewLineAfterInitializeComponentMethodTestFixture.cs


示例15: InvokeCompletionWindow

        public static void InvokeCompletionWindow(TextEditor textEditor)
        {
            completionWindow = new CompletionWindow(textEditor.TextArea);

            completionWindow.Closed += delegate
            {
                completionWindow = null;
            };

            var text = textEditor.Text;
            var offset = textEditor.TextArea.Caret.Offset;

            var completedInput = CommandCompletion.CompleteInput(text, offset, null, PSConsolePowerShell.PowerShellInstance);
            // var r = CommandCompletion.MapStringInputToParsedInput(text, offset);

            "InvokeCompletedInput".ExecuteScriptEntryPoint(completedInput.CompletionMatches);

            if (completedInput.CompletionMatches.Count > 0)
            {
                completedInput.CompletionMatches.ToList()
                    .ForEach(record =>
                    {
                        completionWindow.CompletionList.CompletionData.Add(
                            new CompletionData
                            {
                                CompletionText = record.CompletionText,
                                ToolTip = record.ToolTip,
                                Resultype = record.ResultType,
                                ReplacementLength = completedInput.ReplacementLength
                            });
                    });

                completionWindow.Show();
            }
        }
开发者ID:dfinke,项目名称:PowerShellConsole,代码行数:35,代码来源:TextEditorUtilities.cs


示例16: ScriptingConsoleTextEditor

		public ScriptingConsoleTextEditor(TextEditor textEditor)
		{
			this.textEditor = textEditor;
			readOnlyRegion = new BeginReadOnlySectionProvider();
			textEditor.TextArea.ReadOnlySectionProvider = readOnlyRegion;
			textEditor.PreviewKeyDown += OnTextEditorPreviewKeyDown;
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:7,代码来源:ScriptingConsoleTextEditor.cs


示例17: AutoCompleteTextBox

		public AutoCompleteTextBox()
		{
			object tmp;
			this.editorAdapter = SD.EditorControlService.CreateEditor(out tmp);
			this.editor = (TextEditor)tmp;
			
			this.editor.Background = Brushes.Transparent;
			this.editor.ClearValue(TextEditor.FontFamilyProperty);
			this.editor.ClearValue(TextEditor.FontSizeProperty);
			this.editor.ShowLineNumbers = false;
			this.editor.WordWrap = false;
			this.editor.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
			this.editor.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
			this.editor.TextArea.GotKeyboardFocus += delegate {
				this.Background = Brushes.White;
				this.Foreground = Brushes.Black;
			};
			this.editor.TextArea.LostKeyboardFocus += delegate {
				this.Background = Brushes.Transparent;
				this.ClearValue(ForegroundProperty);
				this.Text = this.editor.Text;
				this.editorAdapter.ClearSelection();
			};
			this.editor.TextArea.PreviewKeyDown += editor_TextArea_PreviewKeyDown;
			this.editor.TextArea.TextEntered += editor_TextArea_TextEntered;
			
			this.Content = this.editor.TextArea;
			
			HorizontalContentAlignment = HorizontalAlignment.Stretch;
			VerticalContentAlignment = VerticalAlignment.Stretch;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:31,代码来源:AutoCompleteTextBox.cs


示例18: ToolTipRequestEventArgs

		public ToolTipRequestEventArgs(TextEditor editor)
		{
			if (editor == null)
				throw new ArgumentNullException("editor");
			this.Editor = editor;
			this.InDocument = true;
		}
开发者ID:95ulisse,项目名称:ILEdit,代码行数:7,代码来源:ToolTipRequestEventArgs.cs


示例19: EditorView

        public EditorView(IApplicationState state)
        {
            InitializeComponent();

            _state = state;

            _editor = new TextEditor();
            _editor.Name = "txtEditor";
            _editor.IsReadOnly = true;
            _editor.Options.EnableEmailHyperlinks = false;
            _editor.Options.EnableHyperlinks = false;
            _editor.TextChanged += OnTextChanged;

            ehoEditor.Child = _editor;

            // folding
            var foldingManager = FoldingManager.Install(_editor.TextArea);
            var foldingStrategy = new GherkinFoldingStrategy();
            Timer foldingTimer = new Timer { Interval = TimeSpan.FromSeconds(2).Seconds };
            foldingTimer.Tick += (s, e) => foldingStrategy.UpdateFoldings(foldingManager, _editor.Document);
            foldingTimer.Start();

            // code completion
            var codeCompletionStrategy = new GherkinCodeCompletionStrategy(_editor, state);

            state.Project.CurrentFeatureChanged += OnCurrentFeatureChanged;
            state.Settings.EditorSettingsChanged += OnEditorSettingsChanged;
        }
开发者ID:testpulse,项目名称:Pickle-Studio,代码行数:28,代码来源:EditorView.cs


示例20: SelectIndexes

        public IEnumerable<int> SelectIndexes(TextEditor textEditor)
        {
            int start = 0;
            int end = 0;

            if (textEditor.SelectionLength != 0)
            {
                start = textEditor.SelectionStart;
                end = textEditor.SelectionStart + textEditor.SelectionLength;
            }
            else
            {
                var position = textEditor.GetPositionFromPoint(MouseUtils.GetMousePosition(textEditor));

                if (position != null)
                {
                    start = textEditor.Document.GetOffset(position.Value.Line, position.Value.Column);
                    end = start;
                }
            }

            var list = new List<int>();

            for (int i = 0; i < _ranges.Count; i++)
            {
                var range = _ranges[i];
                if ((range.Start <= start && range.End <= start) || (range.Start >= end && range.End >= end)) continue;

                list.Add(i);
            }

            return list;
        }
开发者ID:Alliance-Network,项目名称:Amoeba,代码行数:33,代码来源:AvalonEditHelper_MulticastMessage.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CodeCompletion.CompletionWindow类代码示例发布时间:2022-05-26
下一篇:
C# ResultMapping.ResultProperty类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap