Exemple #1
0
        /// <summary>
        /// 打开选定文件
        /// </summary>
        public void func_openfile()
        {
            if (lv_searchresult.SelectedItems.Count > 0)
            {
                string filepath = lv_searchresult.SelectedItems[0].Tag.ToString();
                if (File.Exists(lv_searchresult.SelectedItems[0].Tag.ToString()))
                {
                    try
                    {
                        TabPage tpage = new TabPage(filepath.Substring(filepath.LastIndexOf('\\') + 1));
                        F_code  form  = new F_code();                //动态创建一个窗体
                        form.FormBorderStyle = FormBorderStyle.None; //取消边框
                        form.TopLevel        = false;
                        form.Dock            = DockStyle.Fill;       //控件边缘控制
                        form.txt_search.Text = lv_searchresult.SelectedItems[0].SubItems[2].Text;
                        form.var_filepath    = filepath;
                        tpage.Tag            = filepath;
                        tpage.Controls.Add(form);
                        F_Main.Tab.TabPages.Add(tpage);

                        form.Show();
                        F_Main.Tab.SelectedTab = tpage;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Exemple #2
0
        private void tv_files_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (tv_files.SelectedNode.Tag != null)
                {
                    if (File.Exists(tv_files.SelectedNode.Tag.ToString()))
                    {
                        string selectfile = tv_files.SelectedNode.Tag.ToString();

                        TabPage tpage = new TabPage(selectfile.Substring(selectfile.LastIndexOf('\\') + 1));
                        //tpage.MouseDoubleClick += new MouseEventHandler(tabPage_DoubleClick);
                        F_code form = new F_code();                  //动态创建一个窗体
                        form.FormBorderStyle = FormBorderStyle.None; //取消边框
                        form.TopLevel        = false;
                        form.Dock            = DockStyle.Fill;       //控件边缘控制
                        form.var_filepath    = selectfile;
                        tpage.Controls.Add(form);
                        tpage.Tag = selectfile;
                        tab_main.TabPages.Add(tpage);

                        form.Show();
                        tab_main.SelectedTab = tpage;

                        this.Text = "Seay源代码审计系统  " + selectfile;
                    }
                }
            }
            catch (Exception)
            {
            }
        }