示例#1
0
		//以上全部为一些简单的属性.
		
		//构造函数
		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);
		}
示例#2
0
 public void SetDesiredColumn()
 {
     Caret.DesiredColumn = TextViewMargin.GetDrawingXPos(Caret.Line, Caret.Column) + (int)(VirtualTop.X * textViewMargin.GetWidth(' '));
 }