posts - 124,  comments - 29,  trackbacks - 0

 private string GetTNHtmlName(TreeNode tn)
        {
            int startIndex = tn.Text.LastIndexOf('(');
            int startIndex1 = tn.Text.LastIndexOf('('); ;
            int endIndex = tn.Text.LastIndexOf(')');
            int endIndex1 = tn.Text.LastIndexOf(')');

            if(startIndex1 > startIndex)
            {
                startIndex = startIndex1;
            }
            if (endIndex1 > endIndex)
            {
                endIndex = endIndex1;
            }

            if (startIndex < 0 || endIndex < 0)
            {
                return "res://" + System.Environment.SystemDirectory + @"\system32\shdoclc.dll/http_404.htm";
            }

            string url = "file://" + Application.StartupPath + "/document/" + tn.Text.Substring(startIndex + 1, endIndex - startIndex - 1) + ".htm";
            return url;
        }


        private void TVHelp_MouseClick(object sender, MouseEventArgs e)
        {
            TreeNode selTreenode = tvHelp.GetNodeAt(e.Location);
            if (e.Button == MouseButtons.Left)
            {
                if (selTreenode != null
                    && selTreenode.Nodes.Count == 0)//代表此节点是叶节点
                {
                    this.webBrowser1.Url = new Uri(GetTNHtmlName(selTreenode)) ;
                }
              
            }
        }

posted on 2008-10-19 11:58 天书 阅读(460) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理



<2008年6月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿(5)

随笔档案

文章分类

文章档案

好友的Bolg

搜索

  •  

最新评论

阅读排行榜

评论排行榜