本文整理汇总了C#中ICSharpCode.TextEditor.TextAreaControl类的典型用法代码示例。如果您正苦于以下问题:C# TextAreaControl类的具体用法?C# TextAreaControl怎么用?C# TextAreaControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextAreaControl类属于ICSharpCode.TextEditor命名空间,在下文中一共展示了TextAreaControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextEditorControl
public TextEditorControl()
{
SetStyle(ControlStyles.ContainerControl, true);
textAreaPanel.Dock = DockStyle.Fill;
Document = (new DocumentFactory()).CreateDocument();
Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();
primaryTextArea = new TextAreaControl(this);
activeTextAreaControl = primaryTextArea;
primaryTextArea.TextArea.GotFocus += delegate
{
SetActiveTextAreaControl(primaryTextArea);
};
primaryTextArea.Dock = DockStyle.Fill;
textAreaPanel.Controls.Add(primaryTextArea);
InitializeTextAreaControl(primaryTextArea);
Controls.Add(textAreaPanel);
ResizeRedraw = true;
Document.UpdateCommited += new EventHandler(CommitUpdateRequested);
OptionsChanged();
}
示例2: SetActiveTextAreaControl
protected void SetActiveTextAreaControl(TextAreaControl value)
{
if (activeTextAreaControl != value) {
activeTextAreaControl = value;
if (ActiveTextAreaControlChanged != null) {
ActiveTextAreaControlChanged(this, EventArgs.Empty);
}
}
}
示例3: InitializeTextAreaControl
protected override void InitializeTextAreaControl(TextAreaControl newControl) {
base.InitializeTextAreaControl(newControl);
newControl.TextArea.KeyEventHandler += new KeyEventHandler(HandleKeyPress);
newControl.SelectionManager.SelectionChanged += new EventHandler(SelectionChanged);
newControl.Document.DocumentChanged += new DocumentEventHandler(DocumentChanged);
newControl.Caret.PositionChanged += new EventHandler(CaretPositionChanged);
newControl.TextArea.ClipboardHandler.CopyText += new CopyTextEventHandler(ClipboardHandlerCopyText);
newControl.MouseWheel += new MouseEventHandler(TextAreaMouseWheel);
newControl.DoHandleMousewheel = false;
}
示例4: InitializeTextAreaControl
protected override void InitializeTextAreaControl(TextAreaControl newControl)
{
base.InitializeTextAreaControl(newControl);
newControl.ShowContextMenu += delegate(object sender, MouseEventArgs e) {
MenuService.ShowContextMenu(this, contextMenuPath, (Control)sender, e.X, e.Y);
};
newControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(HandleKeyPress);
newControl.TextArea.ClipboardHandler.CopyText += new CopyTextEventHandler(ClipboardHandlerCopyText);
// newControl.TextArea.IconBarMargin.Painted += new MarginPaintEventHandler(PaintIconBarBreakPoints);
// newControl.TextArea.IconBarMargin.MouseDown += new MarginMouseEventHandler(IconBarMouseDown);
newControl.MouseWheel += new MouseEventHandler(TextAreaMouseWheel);
newControl.DoHandleMousewheel = false;
}
示例5: Dispose
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing) {
if (!disposed) {
disposed = true;
if (caret != null) {
caret.PositionChanged -= new EventHandler(SearchMatchingBracket);
caret.Dispose();
}
if (selectionManager != null) {
selectionManager.Dispose();
}
Document.TextContentChanged -= new EventHandler(TextContentChanged);
Document.FoldingManager.FoldingsChanged -= new EventHandler(DocumentFoldingsChanged);
motherTextAreaControl = null;
motherTextEditorControl = null;
foreach (AbstractMargin margin in leftMargins) {
if (margin is IDisposable)
(margin as IDisposable).Dispose();
}
textView.Dispose();
}
}
}
示例6: ProvidedDocumentInformation
public ProvidedDocumentInformation(IDocument document, string fileName, TextAreaControl textAreaControl)
{
this.document = document;
this.textBuffer = document.TextBufferStrategy;
this.fileName = fileName;
this.textAreaControl = textAreaControl;
this.endOffset = this.CurrentOffset;
}
示例7: InitializeTextAreaControl
protected override void InitializeTextAreaControl(TextAreaControl newControl)
{
newControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(HandleKeyPress);
base.InitializeTextAreaControl(newControl);
}
示例8: TextArea
public TextArea(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl)
{
this.motherTextAreaControl = motherTextAreaControl;
this.motherTextEditorControl = motherTextEditorControl;
caret = new Caret(this);
selectionManager = new SelectionManager(Document);
this.textAreaClipboardHandler = new TextAreaClipboardHandler(this);
ResizeRedraw = true;
SetStyle(ControlStyles.DoubleBuffer, false);
// SetStyle(ControlStyles.AllPaintingInWmPaint, true);
// SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.Opaque, false);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.Selectable, true);
textView = new TextView(this);
gutterMargin = new GutterMargin(this);
foldMargin = new FoldMargin(this);
iconBarMargin = new IconBarMargin(this);
leftMargins.AddRange(new AbstractMargin[] { iconBarMargin, gutterMargin, foldMargin });
OptionsChanged();
new TextAreaMouseHandler(this).Attach();
new TextAreaDragDropHandler().Attach(this);
bracketshemes.Add(new BracketHighlightingSheme('{', '}'));
bracketshemes.Add(new BracketHighlightingSheme('(', ')'));
bracketshemes.Add(new BracketHighlightingSheme('[', ']'));
caret.PositionChanged += new EventHandler(SearchMatchingBracket);
Document.TextContentChanged += new EventHandler(TextContentChanged);
Document.FoldingManager.FoldingsChanged += new EventHandler(DocumentFoldingsChanged);
}
示例9: ReplaceElement
/// <summary>
/// Tries to replace the element defined by element name and its Id attribute in the
/// text editor with the specified xml.
/// </summary>
/// <param name="id">The Id attribute of the element.</param>
/// <param name="elementName">The name of the element.</param>
/// <param name="textAreaControl">The text area control to update.</param>
/// <param name="xml">The replacement xml.</param>
bool ReplaceElement(string id, string elementName, TextAreaControl textAreaControl, string xml)
{
WixDocumentEditor documentEditor = new WixDocumentEditor(textAreaControl);
IDocument document = textAreaControl.Document;
DomRegion region = WixDocument.GetElementRegion(new StringReader(document.TextContent), elementName, id);
if (!region.IsEmpty) {
documentEditor.Replace(region, xml);
return true;
}
return false;
}
示例10: UpdateOpenFileWithRootDirectoryRefChanges
bool UpdateOpenFileWithRootDirectoryRefChanges(WixDocument wixDocument, TextAreaControl textAreaControl)
{
// Get the xml for the root directory ref.
WixDirectoryRefElement rootDirectoryRef = wixDocument.RootDirectoryRef;
string xml = GetWixXml(rootDirectoryRef);
// Find the root directory ref location.
return ReplaceElement(rootDirectoryRef.Id, WixDirectoryRefElement.DirectoryRefElementName, textAreaControl, xml);
}
示例11: UpdateOpenFileWithRootDirectoryChanges
bool UpdateOpenFileWithRootDirectoryChanges(WixDocument wixDocument, TextAreaControl textAreaControl)
{
// Get the xml for the root directory.
WixDirectoryElement rootDirectory = wixDocument.RootDirectory;
string xml = GetWixXml(rootDirectory);
// Find the root directory location.
bool updated = ReplaceElement(rootDirectory.Id, WixDirectoryElement.DirectoryElementName, textAreaControl, xml);
if (updated) {
return true;
}
// Find the product end element location.
IDocument document = textAreaControl.Document;
Location location = WixDocument.GetEndElementLocation(new StringReader(document.TextContent), "Product", wixDocument.Product.GetAttribute("Id"));
if (!location.IsEmpty) {
// Insert the xml with an extra new line at the end.
ITextEditorProperties properties = SharpDevelopTextEditorProperties.Instance;
WixDocumentEditor documentEditor = new WixDocumentEditor(textAreaControl);
documentEditor.Insert(location.Y, location.X, String.Concat(xml, properties.LineTerminator));
return true;
}
return false;
}
示例12: InitializeTextAreaControl
protected override void InitializeTextAreaControl(TextAreaControl newControl)
{
newControl.TextArea.DoProcessDialogKey += HandleDialogKey;
}
示例13: HookEvents
private void HookEvents(TextAreaControl control)
{
control.Caret.CaretModeChanged += (s, e) => UpdateCaretMode();
control.Caret.PositionChanged += (s, e) => UpdateCaretPosition();
control.TextArea.KeyDown += (s, e) => _connectionPoint.ForAll<INiKeyEventNotify>(p => p.OnKeyDown(e.KeyData));
control.TextArea.KeyUp += (s, e) => _connectionPoint.ForAll<INiKeyEventNotify>(p => p.OnKeyUp(e.KeyData));
control.TextArea.KeyPress += (s, e) => _connectionPoint.ForAll<INiKeyEventNotify>(p => p.OnKeyPress(e.KeyChar));
control.TextArea.MouseDown += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseDown(e.Button, e.X, e.Y));
control.TextArea.MouseUp += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseUp(e.Button, e.X, e.Y));
control.TextArea.MouseClick += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseClick(e.Button, e.X, e.Y));
control.TextArea.MouseDoubleClick += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseDoubleClick(e.Button, e.X, e.Y));
control.TextArea.MouseWheel += (s, e) => _connectionPoint.ForAll<INiMouseEventNotify>(p => p.OnMouseWheel(e.Delta));
}
示例14: InitializeTextAreaControl
protected virtual void InitializeTextAreaControl(TextAreaControl newControl)
{
}
示例15: Split
public void Split()
{
if (secondaryTextArea == null) {
secondaryTextArea = new TextAreaControl(this);
secondaryTextArea.Dock = DockStyle.Bottom;
secondaryTextArea.Height = Height / 2;
secondaryTextArea.TextArea.GotFocus += delegate {
SetActiveTextAreaControl(secondaryTextArea);
};
textAreaSplitter = new Splitter();
textAreaSplitter.BorderStyle = BorderStyle.FixedSingle ;
textAreaSplitter.Height = 8;
textAreaSplitter.Dock = DockStyle.Bottom;
textAreaPanel.Controls.Add(textAreaSplitter);
textAreaPanel.Controls.Add(secondaryTextArea);
InitializeTextAreaControl(secondaryTextArea);
secondaryTextArea.OptionsChanged();
} else {
SetActiveTextAreaControl(primaryTextArea);
textAreaPanel.Controls.Remove(secondaryTextArea);
textAreaPanel.Controls.Remove(textAreaSplitter);
secondaryTextArea.Dispose();
textAreaSplitter.Dispose();
secondaryTextArea = null;
textAreaSplitter = null;
}
}