Exemplo n.º 1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            this.Text = Application.ProductName + " v" + Application.ProductVersion;
            //初始化最近打开的文件
            mruManager = new MRUManager();
            mruManager.Initialize(this,
                                  文件ToolStripMenuItem,
                                  最近打开的文件ToolStripMenuItem, // Recent Files menu item
                                  "Software\\MEditor"       // Registry path to keep MRU list
                                  );
            mruManager.CurrentDir           = ".....";      // default is current directory
            mruManager.MaxMRULength         = 10;           // default is 10
            mruManager.MaxDisplayNameLength = 40;

            //定义编辑管理器
            meditorManager = new MarkdownEditorManager(this, tabControl1, mruManager, webBrowser1);
            ReadCss();
            //webBrowser1.Navigate("about:blank");
            meditorManager.SetStyle(rtbHtml);
            //webBrowser1.DocumentText = meditorManager.GetHTMLStyle("");

            _filemonitor = new FileMonitor(fsw_Changed);
            string command = Environment.CommandLine;            //获取进程命令行参数

            if (!string.IsNullOrEmpty(command))
            {
                string[] para = command.Split('\"');
                if (para.Length > 2)
                {
                    string pathC = para[2];                    //获取打开的文件的路径
                    if (pathC.Length > 3)
                    {
                        openfile(pathC);
                    }
                    else
                    {
                        meditorManager.Open("");
                    }
                }
            }
            else
            {
                meditorManager.Open("");
            }

            //this.timer1.Start();
            rtbHtml.EnableAutoDragDrop = false;
            rtbHtml.AllowDrop          = true;

//			rtbHtml.KeyDown += rtbHtml_KeyDown;
            rtbHtml.DragDrop  += new DragEventHandler(frmMain_DragDrop);
            rtbHtml.DragEnter += new DragEventHandler(rtbHtml_DragEnter);

            tabControl1.MouseDown += new MouseEventHandler(tabControl1_MouseDown);
            tabControl2.MouseDown += new MouseEventHandler(tabControl1_MouseDown);
            //tabControl1.GotFocus += new EventHandler(tabControl1_GotFocus);
        }
Exemplo n.º 2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            this.Text = Application.ProductName + " V" + Application.ProductVersion;
            //初始化最近打开的文件
            mruManager = new MRUManager();
            mruManager.Initialize(this,文件ToolStripMenuItem, 最近打开的文件ToolStripMenuItem,                        // Recent Files menu item
                                  "Software\\YihuiStudio\\MEditor"); // Registry path to keep MRU list
            mruManager.CurrentDir = ".....";           // default is current directory
            mruManager.MaxMRULength = 10;             // default is 10
            mruManager.MaxDisplayNameLength = 40;

            //定义编辑管理器
            meditorManager = new MarkdownEditorManager(this, tabControl1, mruManager,webBrowser1);
            ReadCss();
            //webBrowser1.Navigate("about:blank");
            meditorManager.SetStyle(rtbHtml);
            //webBrowser1.DocumentText = meditorManager.GetHTMLStyle("");

            _filemonitor = new FileMonitor(fsw_Changed);
            string command = Environment.CommandLine;//获取进程命令行参数
            if (!string.IsNullOrEmpty(command))
            {
                string[] para = command.Split('\"');
                if (para.Length > 2)
                {
                    string pathC = para[2];//获取打开的文件的路径
                    if (pathC.Length > 3)
                    {
                        openfile(pathC);
                    }
                    else
                    {
                        meditorManager.Open("");
                    }
                }
            }
            else
            {
                meditorManager.Open("");
            }

            //this.timer1.Start();
            rtbHtml.EnableAutoDragDrop = false;
            rtbHtml.AllowDrop = true;

            //			rtbHtml.KeyDown += rtbHtml_KeyDown;
            rtbHtml.DragDrop += new DragEventHandler(frmMain_DragDrop);
            rtbHtml.DragEnter += new DragEventHandler(rtbHtml_DragEnter);

            tabControl1.MouseDown += new MouseEventHandler(tabControl1_MouseDown);
            tabControl2.MouseDown+=new MouseEventHandler(tabControl1_MouseDown);
            //tabControl1.GotFocus += new EventHandler(tabControl1_GotFocus);
        }