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


C# AvalonEdit.TextEditor类代码示例

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


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


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