コード例 #1
0
ファイル: EditorWinForm.cs プロジェクト: y1026/InnovatorAdmin
        public EditorWinForm()
        {
            InitializeComponent();

            var host = new ElementHost();

            host.Size     = new Size(200, 100);
            host.Location = new Point(100, 100);
            host.Dock     = DockStyle.Fill;

            _extEditor              = new ExtendedEditor();
            _extEditor.Host         = this;
            _extEditor.FileOpening += (s, e) =>
            {
                if (FileOpening != null)
                {
                    FileOpening.Invoke(this, e);
                }
            };

            var editor = _extEditor.editor;

            editor.FontFamily = _fixedWidth;
            editor.FontSize   = 12.0;
            editor.Options.ConvertTabsToSpaces        = true;
            editor.Options.EnableRectangularSelection = true;
            editor.Options.IndentationSize            = 2;
            editor.ShowLineNumbers = true;
            editor.TextArea.MouseRightButtonDown += TextArea_MouseRightButtonDown;
            editor.TextArea.PreviewKeyDown       += TextArea_PreviewKeyDown;
            editor.TextArea.TextEntering         += TextArea_TextEntering;
            editor.TextArea.TextEntered          += TextArea_TextEntered;
            editor.TextArea.KeyDown                     += TextArea_KeyDown;
            editor.TextArea.TextView.MouseHover         += TextView_MouseHover;
            editor.TextArea.TextView.MouseHoverStopped  += TextView_MouseHoverStopped;
            editor.TextArea.TextView.VisualLinesChanged += TextView_VisualLinesChanged;
            editor.TextArea.SelectionChanged            += TextArea_SelectionChanged;
            editor.TextArea.Caret.PositionChanged       += Caret_PositionChanged;
            editor.TextChanged += editor_TextChanged;

            host.Child = _extEditor;

            editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();

            this.Controls.Add(host);

            BindToolStripItem(mniCut, System.Windows.Input.ApplicationCommands.Cut);
            BindToolStripItem(mniCopy, System.Windows.Input.ApplicationCommands.Copy);
            BindToolStripItem(mniPaste, System.Windows.Input.ApplicationCommands.Paste);
        }
コード例 #2
0
    public EditorWinForm()
    {
      InitializeComponent();

      var host = new ElementHost();
      host.Size = new Size(200, 100);
      host.Location = new Point(100, 100);
      host.Dock = DockStyle.Fill;

      _extEditor = new ExtendedEditor();
      _extEditor.Host = this;
      _extEditor.FileOpening += (s, e) =>
      {
        if (FileOpening != null)
          FileOpening.Invoke(this, e);
      };

      var editor = _extEditor.editor;
      editor.FontFamily = _fixedWidth;
      editor.FontSize = 12.0;
      editor.Options.ConvertTabsToSpaces = true;
      editor.Options.EnableRectangularSelection = true;
      editor.Options.IndentationSize = 2;
      editor.ShowLineNumbers = true;
      editor.TextArea.MouseRightButtonDown += TextArea_MouseRightButtonDown;
      editor.TextArea.PreviewKeyDown += TextArea_PreviewKeyDown;
      editor.TextArea.TextEntering += TextArea_TextEntering;
      editor.TextArea.TextEntered += TextArea_TextEntered;
      editor.TextArea.KeyDown += TextArea_KeyDown;
      editor.TextArea.TextView.MouseHover += TextView_MouseHover;
      editor.TextArea.TextView.MouseHoverStopped += TextView_MouseHoverStopped;
      editor.TextArea.TextView.VisualLinesChanged += TextView_VisualLinesChanged;
      editor.TextArea.SelectionChanged += TextArea_SelectionChanged;
      editor.TextArea.Caret.PositionChanged += Caret_PositionChanged;
      editor.TextChanged += editor_TextChanged;

      host.Child = _extEditor;

      editor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();

      this.Controls.Add(host);

      BindToolStripItem(mniCut, System.Windows.Input.ApplicationCommands.Cut);
      BindToolStripItem(mniCopy, System.Windows.Input.ApplicationCommands.Copy);
      BindToolStripItem(mniPaste, System.Windows.Input.ApplicationCommands.Paste);
    }