コード例 #1
0
ファイル: MainForm.cs プロジェクト: FileEX/Small-Code-Editor
        private void addNewTab(string name)
        {
            var page = new TabPage(Path.GetFileName(name));

            tabControl1.TabPages.Add(page);

            var textEditorControl1 = new ICSharpCode.TextEditor.TextEditorControl();

            textEditorControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                               | System.Windows.Forms.AnchorStyles.Left)
                                                                              | System.Windows.Forms.AnchorStyles.Right)));

            page.Controls.Add(textEditorControl1);

            textEditorControl1.Size = new Size(new Point(tabControl1.Size.Width - 6, 339 - 24));

            ApplySyntax(ref textEditorControl1);
            InitalizeTheme(themeLoader.GetData());

            textEditorControl1.Refresh();

            // Console
            listView1 = new ListView();

            listView1.Location = new Point(0, 320);
            listView1.Name     = "listView1";
            listView1.Size     = new Size(785, 100);
            listView1.TabIndex = 7;
            listView1.UseCompatibleStateImageBehavior = false;

            listView1.View          = View.Details;
            listView1.GridLines     = true;
            listView1.FullRowSelect = true;

            listView1.Columns.Add("#", 20);
            listView1.Columns.Add("Value", 450, HorizontalAlignment.Center);
            listView1.Columns.Add("Line", 280, HorizontalAlignment.Center);

            listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Bottom)
                                                                      | System.Windows.Forms.AnchorStyles.Left)
                                                                     | System.Windows.Forms.AnchorStyles.Right)));

            page.Controls.Add(listView1);

            tabControl1.SelectedTab = page;

            setPageData(tabControl1.SelectedTab.TabIndex, name);
        }
コード例 #2
0
        public TextEditorDocumentWrapper()
        {
            //Document = (new DocumentFactory()).CreateDocument();
            //Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();

            Document = TheOneAndOnly.Document;

            // remove other listeners
            //RemoveAllChangedHandlers();
            if (PreviousInstance != null)
            {
                PreviousInstance.Dispose();
            }
            PreviousInstance = this;

            TheOneAndOnly.ResetText();
            Document.UndoStack.ClearAll();
            TheOneAndOnly.Refresh();

            Document.DocumentChanged += new DocumentEventHandler(Document_DocumentChanged);
        }