public TextEditorView() { textEditorControl = new TextEditorControl(); textEditorControl.Document.DocumentChanged += new DocumentEventHandler(TextAreaChangedEvent); textEditorControl.ActiveTextAreaControl.Caret.CaretModeChanged += new EventHandler(CaretModeChanged); textEditorControl.ActiveTextAreaControl.Enter += new EventHandler(CaretUpdate); textEditorControl.ActiveTextAreaControl.Caret.PositionChanged +=new EventHandler(CaretChanged); ((Form)WorkbenchSingleton.Workbench).Activated += new EventHandler(GotFocusEvent); }
public TextAreaControl(TextEditorControl motherTextEditorControl) { this.motherTextEditorControl = motherTextEditorControl; this.textArea = new TextArea(motherTextEditorControl, this); this.Controls.Add(textArea); //将TextArea用户控件加到Panel中. vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged); this.Controls.Add(this.vScrollBar); hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged); this.Controls.Add(this.hScrollBar); ResizeRedraw = true; //调整大小时重会自己. Document.DocumentChanged += new DocumentEventHandler(AdjustScrollBars); SetStyle(ControlStyles.Selectable, true); //可以获得焦点. }
//以上全部为一些简单的属性. //构造函数 public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl) { this.motherTextAreaControl = motherTextAreaControl; this.motherTextEditorControl = motherTextEditorControl; caret = new Caret(this);//附加插入符. selectionManager = new SelectionManager(Document);//附加选择管理器. ResizeRedraw = true; SetStyle(ControlStyles.DoubleBuffer, false); SetStyle(ControlStyles.Opaque, false); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.Selectable, true); textViewMargin = new TextViewMargin(this);//附加主要的文本区域。 gutterMargin = new GutterMargin(this);//附加装订线区域. foldMargin = new FoldMargin(this);//附加折叠区域. iconBarMargin = new IconBarMargin(this);//附加图标栏区域. leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin }); OptionsChanged(); textAreaClipboardHandler = new TextAreaClipboardHandler(this);//附加剪切办处理程序. new TextAreaMouseHandler(this).Attach(); new TextAreaDragDropHandler().Attach(this); bracketshemes.Add(new BracketHighlightingScheme('{', '}')); bracketshemes.Add(new BracketHighlightingScheme('(', ')')); bracketshemes.Add(new BracketHighlightingScheme('[', ']')); caret.PositionChanged += new EventHandler(SearchMatchingBracket); Document.TextContentChanged += new EventHandler(TextContentChanged); Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged); }
public TextAreaControl(TextEditorControl motherTextEditorControl) { this.motherTextEditorControl = motherTextEditorControl; this.textArea = new TextArea(motherTextEditorControl, this); this.Controls.Add(textArea);//将TextArea用户控件加到Panel中. vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged); this.Controls.Add(this.vScrollBar); hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged); this.Controls.Add(this.hScrollBar); ResizeRedraw = true;//调整大小时重会自己. Document.DocumentChanged += new DocumentEventHandler(AdjustScrollBars); SetStyle(ControlStyles.Selectable, true);//可以获得焦点. }