/// <summary>
 /// 
 /// </summary>
 /// <param name="templateControl"></param>
 /// <param name="propertyName"></param>
 /// <param name="handleActivationClick"></param>
 protected MyMaskTextEditor(WinTextBox templateControl, string propertyName, bool handleActivationClick)
     : base(templateControl, propertyName, handleActivationClick)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="template"></param>
 public MyMaskTextEditor(WinTextBox template)
     : base(template)
 {
 }
Beispiel #3
0
        public void OpenDocumentWithNewTab(string filename)
        {
            _Filename = filename;
            string tabText = Path.GetFileName(filename);

            int index = -1;

            for (int i = 0; i < tabControl1.TabCount; i++)
            {
                index = -1;
                if (tabControl1.TabPages[i].Text == tabText)
                {
                    index = i;
                    break;
                }
            }

            if (index == -1)
            {
                TabPage tabPage1 = new TabPage(tabText);
                Document doc = new Document();

                doc.Parent = tabPage1;
                doc.Dock = DockStyle.Fill;
                doc.Name = "document1";
                doc.FullFileName = filename;
                //tabPage1.BackColor = Color.White;

                tabPage1.ToolTipText = filename;
                tabControl1.TabPages.Add(tabPage1);
                tabControl1.SelectedTab = tabControl1.TabPages[tabControl1.TabCount - 1];

                doc.filelistview1 = filelistview1;
                //
                wintextbox1 = document1.winTextBox1;
                wintextbox1.TextChanged += new System.EventHandler(this.wintextbox1_TextChanged);
            }
            else
            {
                tabControl1.SelectedTab = tabControl1.TabPages[index];
            }
        }
Beispiel #4
0
        public void NewDocument(string filename)
        {
            string tabText = Path.GetFileName(filename);

            TabPage tabPage1 = new TabPage(tabText);

            Document doc = new Document();
            doc.Name = "document1";
            doc.Parent = tabPage1;
            doc.Dock = DockStyle.Fill;
            doc.FullFileName = filename;
            doc.htmEdit1.NewDocument(filename);
            doc.btnReadMode1.Text = "阅读";
            doc.winTextBox1.Modified = false;

            tabPage1.ToolTipText = filename;
            //tabPage1.BackColor = Color.White;
            tabControl1.TabPages.Add(tabPage1);
            tabControl1.SelectedTab = tabControl1.TabPages[tabControl1.TabCount - 1];

            doc.filelistview1 = filelistview1;

            //
            wintextbox1 = document1.winTextBox1;
            wintextbox1.TextChanged += new System.EventHandler(this.wintextbox1_TextChanged);
        }
Beispiel #5
0
        private void htmEdit1_OnNewDocument(object sender, EventArgs e)
        {
            if (winTextBox1.Modified == false)
             {
                 //新建立的文件名自动重命名
                 RichTextBox tmpRichTextBox1 = new RichTextBox();
                 tmpRichTextBox1.Text = htmEdit1.webBrowser1.Document.Body.InnerText;

                 //移动空行
                 string s = "";
                 for (int i = 0; i < tmpRichTextBox1.Lines.Length; i++)
                 {
                     if (tmpRichTextBox1.Lines[i].Trim() != "\r\n")
                         s += tmpRichTextBox1.Lines[i] + "\r\n";
                 }

                 tmpRichTextBox1.Text = tmpRichTextBox1.Text.Trim();

                 WinTextBox tmpWinTextBox1 = new WinTextBox();
                 tmpWinTextBox1.Text = tmpRichTextBox1.Lines[0];

                 string filename = Path.GetDirectoryName(FullFileName) + "\\" + tmpWinTextBox1.Text + ".htm";
                 filename = FileCore.NewName(filename);
                 if (!File.Exists(filename))
                 {
                     string name1 = Path.GetFileNameWithoutExtension(filename);
                     if (name1.Length <= winTextBox1.MaxLength)
                     {
                         winTextBox1.Text = name1;
                         winTextBox1_LostFocus(sender, e);
                     }
                 }

                 tmpRichTextBox1.Dispose();
                 tmpWinTextBox1.Dispose();
             }
        }