Exemplo n.º 1
0
        public void opennewtab()
        {
            //System.Windows.Forms.MessageBox.Show(tabControl1.TabPages.Count.ToString());
            FastColoredTextBox fst = new FastColoredTextBox();

            Elegant.Ui.TabPage tabpg = new Elegant.Ui.TabPage();
            tabpg.TabIndex = tabControl1.TabPages.Count;
            tabControl1.TabPages.AddRange(new Elegant.Ui.TabPage[] { tabpg });
            tabControl1.SelectNextTab();
            tabControl1.SelectedTabPage.Text = "New tab" + (tabControl1.TabPages.Count).ToString();
            tabControl1.SelectedTabPage.Controls.Add(fst);
            fst.Dock = DockStyle.Fill;
            //System.Windows.Forms.MessageBox.Show(tabControl1.TabPages.Count.ToString());
            fst.Focus();
            tabControl1.SelectedTabPage.Tag = "";
        }
Exemplo n.º 2
0
        public void openfile(string filename)
        {
            int tempstatus = 0;

            for (int i = 0; i < tabControl1.TabPages.Count; i++)
            {
                if (tabControl1.TabPages[i].Tag == filename)
                {
                    Elegant.Ui.MessageBox.Show("The Selected File is already open in the Editor");
                    tempstatus = 1;
                }
            }
            if (tempstatus == 0)
            {
                FastColoredTextBox fst   = new FastColoredTextBox();
                Elegant.Ui.TabPage tabpg = new Elegant.Ui.TabPage();
                tabpg.TabIndex = tabControl1.TabPages.Count;
                tabControl1.TabPages.AddRange(new Elegant.Ui.TabPage[] { tabpg });
                tabControl1.SelectNextTab();
                FileInfo fio = new FileInfo(filename);
                tabControl1.SelectedTabPage.Text = fio.Name;
                tabControl1.SelectedTabPage.Tag  = filename;
                tabControl1.SelectedTabPage.Controls.Add(fst);
                fst.Dock = DockStyle.Fill;
                // fst.AutoIndentNeeded += fstemp_AutoIndentNeeded;

                FileInfo fi = new FileInfo(filename);
                textboxlanguage(fst, fi.Extension);
                fileread(fst, filename);
                fst.SelectAll();
                fst.DoAutoIndent();
                fst.Text            = fst.Text + "";
                static_focused_file = filename;
                if (filename.Contains(".java"))
                {
                    tb_compile.Enabled       = true;
                    tb_run.Enabled           = true;
                    tb_compileandrun.Enabled = true;
                }
            }
        }