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
天书 阅读(505)
评论(0) 编辑 收藏 引用