public TextEditorControl() { this.SetStyle(ControlStyles.ContainerControl, true); this.SetStyle(ControlStyles.Selectable, true); this.ResizeRedraw = true; Document = (new DocumentFactory()).CreateDefaultDocument(); Document.HighlightingStrategy = HighlightingManager.Manager.HighlightingDefinitions["Default"] as DefaultHighlightingStrategy; textAreaControl = new TextAreaControl(this); textAreaControl.Dock = DockStyle.Fill; InitializeTextAreaControl(textAreaControl); this.Controls.Add(textAreaControl); //注意:下面为Document.UpdateCommited事件添加了处理程序, //所以当Document.OnUpdateCommited()方法被调用到时,会调用这里注册的处理程序. //而Document.OnUpdateCommited()方法应该由这个类中的EndUpdate()方法来调用到。 Document.UpdateCommited += new EventHandler(CommitUpdateRequested); TextEditorProperties = new DefaultTextEditorProperties(); OptionsChanged(); }