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

C# TextEditor.TextEditorControl类代码示例

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

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



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

示例1: CreateTextBox

        private TextEditorControl CreateTextBox()
        {
            var tb = new TextEditorControl();
            tb.IsReadOnly = true;            
            
            // TODO: set proper highlighting.
            tb.SetHighlighting("C#");

            var high = (ICSharpCode.TextEditor.Document.DefaultHighlightingStrategy)tb.Document.HighlightingStrategy;
            var def = high.Rules.First();
            var delim = " ,().:\t\n\r";
            for(int i = 0; i < def.Delimiters.Length; ++i)
                def.Delimiters[i] = delim.Contains((char)i);

            tb.ShowLineNumbers = false;
            tb.ShowInvalidLines = false;
            tb.ShowVRuler = false;
            tb.ActiveTextAreaControl.TextArea.ToolTipRequest += OnToolTipRequest;
            tb.ActiveTextAreaControl.TextArea.MouseMove += OnTextAreaMouseMove;

            string[] tryFonts = new[] { "Consolas", "Lucida Console" };

            foreach (var fontName in tryFonts)
            {
                tb.Font = new Font(fontName, 9, FontStyle.Regular);
                if (tb.Font.Name == fontName) break;
            }

            if (!tryFonts.Contains(tb.Font.Name))
                tb.Font = new Font(FontFamily.GenericMonospace, 9);
            
            return tb;
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:33,代码来源:TextNode.cs


示例2: CreateEditor

 /// <summary>
 /// Creates the appropriate ITextEditor instance for the given text editor
 /// </summary>
 /// <param name="textEditor">The text editor instance</param>
 /// <returns></returns>
 public static ITextEditor CreateEditor(TextEditorControl textEditor)
 {
     if (Platform.IsRunningOnMono)
         return new MonoCompatibleTextEditor(textEditor);
     else
         return new DefaultTextEditor(textEditor);
 }
开发者ID:kanbang,项目名称:Colt,代码行数:12,代码来源:TextEditor.cs


示例3: TextAreaControl

        public TextAreaControl(TextEditorControl motherTextEditorControl)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea                = new TextArea(motherTextEditorControl, this);
            Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
            Controls.Add(this.hScrollBar);
            ResizeRedraw = true;

            Document.TextContentChanged += DocumentTextContentChanged;
            Document.DocumentChanged += AdjustScrollBarsOnDocumentChange;
            Document.UpdateCommited  += DocumentUpdateCommitted;

            vScrollBar.VisibleChanged += (sender, e) =>
            {
                if (!vScrollBar.Visible)
                    vScrollBar.Value = 0;
            };

            hScrollBar.VisibleChanged += (sender, e) =>
            {
                if (!hScrollBar.Visible)
                    hScrollBar.Value = 0;
            };
        }
开发者ID:ArsenShnurkov,项目名称:ospa-texteditor,代码行数:30,代码来源:TextAreaControl.cs


示例4: ShowFor

		public void ShowFor(TextEditorControl editor, bool replaceMode)
		{
            //this.Text = replaceMode ? "查找和替换" : "查找";
			Editor = editor;

			_search.ClearScanRegion();
            SelectionManager sm = editor.ActiveTextAreaControl.SelectionManager;
			if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1) {
                ISelection sel = sm.SelectionCollection[0];
				if (sel.StartPosition.Line == sel.EndPosition.Line)
					txtLookFor.Text = sm.SelectedText;
				else
					_search.SetScanRegion(sel);
			} else {
				// Get the current word that the caret is on
				Caret caret = editor.ActiveTextAreaControl.Caret;
				int start = TextUtilities.FindWordStart(editor.Document, caret.Offset);
				int endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset);
				txtLookFor.Text = editor.Document.GetText(start, endAt - start);
			}
			
			ReplaceMode = replaceMode;

			this.Owner = (Form)editor.TopLevelControl;
			this.Show();
			
			txtLookFor.SelectAll();
			txtLookFor.Focus();
		}
开发者ID:jojozhuang,项目名称:Projects,代码行数:29,代码来源:FindAndReplaceForm.cs


示例5: EditValue

        /// <inheritdoc/>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            #region Sanity checks
            if (context == null) throw new ArgumentNullException(nameof(context));
            if (provider == null) throw new ArgumentNullException(nameof(provider));
            #endregion

            var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService == null) return value;

            var editorControl = new TextEditorControl {Text = value as string, Dock = DockStyle.Fill};
            var form = new Form
            {
                FormBorderStyle = FormBorderStyle.SizableToolWindow,
                ShowInTaskbar = false,
                Controls = {editorControl}
            };

            var fileType = context.PropertyDescriptor.Attributes.OfType<FileTypeAttribute>().FirstOrDefault();
            if (fileType != null)
            {
                editorControl.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(fileType.FileType);
                form.Text = fileType.FileType + " Editor";
            }
            else form.Text = "Editor";

            editorService.ShowDialog(form);
            return editorControl.Text;
        }
开发者ID:nano-byte,项目名称:common,代码行数:30,代码来源:CodeEditor.cs


示例6: SetContent

        /// <summary>
        /// Sets a new text to be edited.
        /// </summary>
        /// <param name="text">The text to set.</param>
        /// <param name="format">The format named used to determine the highlighting scheme (e.g. XML).</param>
        public void SetContent(string text, string format)
        {
            var textEditor = new TextEditorControl
            {
                Location = new Point(0, 0),
                Size = Size - new Size(0, statusStrip.Height),
                Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom,
                TabIndex = 0,
                ShowVRuler = false,
                Document =
                {
                    TextContent = text,
                    HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(format)
                }
            };
            textEditor.TextChanged += TextEditor_TextChanged;
            textEditor.Validating += TextEditor_Validating;

            Controls.Add(textEditor);
            if (TextEditor != null)
            {
                Controls.Remove(TextEditor);
                TextEditor.Dispose();
            }
            TextEditor = textEditor;

            SetStatus(ImageResources.Info, "OK");
        }
开发者ID:nano-byte,项目名称:common,代码行数:33,代码来源:LiveEditor.cs


示例7: SetLine

 public static void SetLine(TextEditorControl tec, int line)
 {
     TextArea textArea = tec.ActiveTextAreaControl.TextArea;
     textArea.Caret.Column = 0;
     textArea.Caret.Line = line;
     textArea.Caret.UpdateCaretPosition();
 }
开发者ID:rgiot,项目名称:phactory,代码行数:7,代码来源:TextUtils.cs


示例8: IncrementalSearch

		/// <summary>
		/// Creates an incremental search for the specified text editor.
		/// </summary>
		/// <param name="textEditor">The text editor to search in.</param>
		/// <param name="forwards">Indicates whether the search goes
		/// forward from the cursor or backwards.</param>
		public IncrementalSearch(TextEditorControl textEditor, bool forwards)
		{
			
			this.forwards = forwards;
			if (forwards) {
				incrementalSearchStartMessage = StringParser.Parse("${res:ICSharpCode.SharpDevelop.DefaultEditor.IncrementalSearch.ForwardsSearchStatusBarMessage} ");
			} else {
				incrementalSearchStartMessage = StringParser.Parse("${res:ICSharpCode.SharpDevelop.DefaultEditor.IncrementalSearch.ReverseSearchStatusBarMessage} ");
			}
			this.textEditor = textEditor;
			
			// Disable code completion.
			codeCompletionEnabled = CodeCompletionOptions.EnableCodeCompletion;
			CodeCompletionOptions.EnableCodeCompletion = false;
			
			AddFormattingStrategy();
			
			TextArea.KeyEventHandler += TextAreaKeyPress;
			TextArea.DoProcessDialogKey += TextAreaProcessDialogKey;
			TextArea.LostFocus += TextAreaLostFocus;
			TextArea.MouseClick += TextAreaMouseClick;
			
			EnableIncrementalSearchCursor();
			
			// Get text to search and initial search position.
			text = textEditor.Document.TextContent;
			startIndex = TextArea.Caret.Offset;
			originalStartIndex = startIndex;
		
			GetInitialSearchText();
			ShowTextFound(searchText.ToString());
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:38,代码来源:IncrementalSearch.cs


示例9: DiffPanel

		public DiffPanel(IViewContent viewContent)
		{
			this.viewContent = viewContent;
			
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			textEditor = new TextEditorControl();
			textEditor.Dock = DockStyle.Fill;
			diffViewPanel.Controls.Add(textEditor);
			
			textEditor.TextEditorProperties = SharpDevelopTextEditorProperties.Instance;
			textEditor.Document.ReadOnly = true;
			textEditor.Enabled = false;
			
			textEditor.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("Patch");
			
			ListViewItem newItem;
			newItem = new ListViewItem(new string[] { "Base", "", "", "" });
			newItem.Tag = Revision.Base;
			leftListView.Items.Add(newItem);
			newItem.Selected = true;
			newItem = new ListViewItem(new string[] { "Work", "", "", "" });
			newItem.Tag = Revision.Working;
			rightListView.Items.Add(newItem);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:28,代码来源:DiffPanel.cs


示例10: FdoSqlQueryCtl

 public FdoSqlQueryCtl()
 {
     InitializeComponent();
     _editor = new TextEditorControl();
     _editor.Dock = DockStyle.Fill;
     _editor.SetHighlighting("SQL");
     this.Controls.Add(_editor);
 }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:8,代码来源:FdoSqlQueryCtl.cs


示例11: GetEditor

        public override System.Windows.Forms.Control GetEditor()
        {
            //return base.GetEditor();
            if (textEditor == null)
                textEditor = new TextEditorControl();

            return textEditor;
        }
开发者ID:koksaver,项目名称:CodeHelper,代码行数:8,代码来源:DataModelNode.cs


示例12: Goto

 public Goto(TextEditorControl editor)
 {
     InitializeComponent();
     Editor = editor;
     Editor.TextChanged += Editor_TextChanged;
     UpdateMaximumLine();
     numericUpDown.Select(0, numericUpDown.Value.ToString().Length);
 }
开发者ID:Quackmatic,项目名称:VisualTrillek,代码行数:8,代码来源:Goto.cs


示例13: IdeBridgeCodeCompletionWindow

 protected IdeBridgeCodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, bool showDeclarationWindow, bool fixedListViewWidth)
     : base(completionDataProvider, completionData, parentForm, control, showDeclarationWindow, fixedListViewWidth)
 {
     TopMost = true;
     declarationViewWindow.Dispose();
     declarationViewWindow = new DeclarationViewWindow(null);
     declarationViewWindow.TopMost = true;
     SetDeclarationViewLocation();
 }
开发者ID:emacsattic,项目名称:idebridge,代码行数:9,代码来源:IdeBridgeCodeCompletionWindow.cs


示例14: Test_DeleteNotEmptyAt0

 public void Test_DeleteNotEmptyAt0()
 {
     ICSharpCode.TextEditor.TextEditorControl textEditorControl = new ICSharpCode.TextEditor.TextEditorControl();
     textEditorControl.Text = "test content";
     textEditorTextContext = new TextEditorTextContext(textEditorControl);
     DeleteOperation delete = new DeleteOperation(0);
     textEditorTextContext.Delete(null, delete);
     Assert.AreEqual("est content", textEditorTextContext.Data, "Inconsistent state after deletion!");
 }
开发者ID:424f,项目名称:lebowski,代码行数:9,代码来源:TextEditorTextContextTest.cs


示例15: Ast_CSharp_ShowDetailsInViewer

 public Ast_CSharp_ShowDetailsInViewer(TextEditorControl _textEditorControl, TabControl _tabControl)
 {
     /*sourceCodeEditor = _sourceCodeEditor;
     tabControl = (TabControl)sourceCodeEditor.field("tcSourceInfo");
      * */
     tabControl = _tabControl;
     textEditorControl = _textEditorControl;
     createGUI();
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:9,代码来源:Ast_CSharp_ShowDetailsInViewer.cs


示例16: TextEditorTextContext

        /// <summary>
        /// Initializes a new instance of the TextEditorTextContent class.
        /// This TextEditorTextContent instance will be linked with a
        /// TextEditorControl.
        /// </summary>
        /// <param name="textBox">The TextEditorControl to link with.</param>
        public TextEditorTextContext(TextEditorControl textBox)
        {
            TextBox = textBox;
            SubscribeToTextBox();

            remoteMarker = new TextMarker(0, 0, TextMarkerType.SolidBlock, System.Drawing.Color.Yellow);

            // TODO: implement insert / delete
        }
开发者ID:424f,项目名称:lebowski,代码行数:15,代码来源:TextEditorTextContext.cs


示例17: MethodExtractorBase

		public MethodExtractorBase(ICSharpCode.TextEditor.TextEditorControl textEditor, ISelection selection)
		{
			this.currentDocument = textEditor.Document;
			this.textEditor = textEditor;
			this.currentSelection = selection;
			
			this.start = new Location(this.currentSelection.StartPosition.Column + 1, this.currentSelection.StartPosition.Line + 1);
			this.end = new Location(this.currentSelection.EndPosition.Column + 1, this.currentSelection.EndPosition.Line + 1);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:9,代码来源:MethodExtractorBase.cs


示例18: DefinitionViewPad

		/// <summary>
		/// Creates a new DefinitionViewPad object
		/// </summary>
		public DefinitionViewPad()
		{
			ctl = new TextEditorControl();
			ctl.Document.ReadOnly = true;
			ctl.TextEditorProperties = SharpDevelopTextEditorProperties.Instance;
			ctl.ActiveTextAreaControl.TextArea.DoubleClick += OnDoubleClick;
			ParserService.ParserUpdateStepFinished += OnParserUpdateStep;
			ctl.VisibleChanged += delegate { UpdateTick(null); };
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:12,代码来源:DefinitionViewPad.cs


示例19: OnLoad

        protected override async void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            PopulateDetails();

            var msilEditor = new TextEditorControl
            {
                IsReadOnly = true,
                Dock = DockStyle.Fill,
                Text = Decompiler.DecompileToIL(MethodDef.Body)
            };
            msiltab.Controls.Add(msilEditor);

            var codeEditor = new TextEditorControl
            {
                IsReadOnly = true,
                Dock = DockStyle.Fill,
                Text = await Decompiler.GetSourceCode(MethodDef),
                Document = { HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#") }
            };
            codetab.Controls.Add(codeEditor);

            if (!MethodDef.HasBody)
            {
                hookbutton.Enabled = false;
                gotohookbutton.Enabled = false;
                return;
            }

            MethodSignature methodsig = Utility.GetMethodSignature(MethodDef);

            bool hookfound = false;
            foreach (var manifest in MainForm.CurrentProject.Manifests)
            {
                foreach (var hook in manifest.Hooks)
                {
                    if (hook.Signature.Equals(methodsig) && hook.TypeName == MethodDef.DeclaringType.FullName)
                    {
                        hookfound = true;
                        methodhook = hook;
                        break;
                    }
                }
            }
            if (hookfound)
            {
                hookbutton.Enabled = false;
                gotohookbutton.Enabled = true;
            }
            else
            {
                hookbutton.Enabled = true;
                gotohookbutton.Enabled = false;
            }
        }
开发者ID:AEtherSurfer,项目名称:OxidePatcher,代码行数:56,代码来源:MethodViewControl.cs


示例20: GetCurrentClass

		/// <summary>
		/// Returns the class in which the carret currently is, returns null
		/// if the carret is outside the class boundaries.
		/// </summary>
		IClass GetCurrentClass(TextEditorControl textEditorControl, ICompilationUnit cu, string fileName)
		{
			IDocument document = textEditorControl.Document;
			if (cu != null) {
				int caretLineNumber = document.GetLineNumberForOffset(textEditorControl.ActiveTextAreaControl.Caret.Offset) + 1;
				int caretColumn     = textEditorControl.ActiveTextAreaControl.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1;
				return FindClass(cu.Classes, caretLineNumber, caretColumn);
			}
			return null;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:14,代码来源:GenerateCodeCommand.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Document.LineSegment类代码示例发布时间:2022-05-26
下一篇:
C# TextEditor.TextAreaControl类代码示例发布时间: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