void WebBrower_WBLButtonUp(object sender, csExWB.HTMLMouseEventArgs e) { if (e.SrcElement != null) { //user is scrolling using scrollbars //if (e.SrcElement.tagName == "HTML") // return; //If DIV then we can look for an HTML child element //AllForms.m_frmLog.AppendToLog("cEXWB1_WBLButtonUp==>" + e.SrcElement.tagName); TreeNodeEx tnRet = null; foreach (var tn in HtmlTree.Nodes) { var treeNodeEx = tn as TreeNodeEx; var selectedElement = new SelectedElement(); selectedElement.tagName = e.SrcElement.tagName.ToLower(); selectedElement.innerText = e.SrcElement.innerText; tnRet = this.FindNodeExt(treeNodeEx, selectedElement); if (tnRet != null) { break; } } if (tnRet != null) { tnRet.ForeColor = Color.Red; tnRet.Expand(); HtmlTree.SelectedNode = tnRet; var sb = new StringBuilder(); sb.AppendLine("xpath:" + tnRet.HtmlNode.XPath); sb.AppendLine(HtmlAgilityPackHelper.GetStringByXPath(Html, tnRet.HtmlNode.XPath, "|")); richTextBox.Text += sb.ToString(); } } else { //AllForms.m_frmLog.AppendToLog("cEXWB1_WBLButtonUp"); } //Rectangle rt = new Rectangle(m_mposX - 1, m_mposY - 1, 2, 2); //if (rt.Contains(e.ClientX, e.ClientY)) //{ // //AllForms.m_frmLog.AppendToLog("MOUSE CLICKED"); //} }
private void btnSearch_Click(object sender, EventArgs e) { TreeNodeEx tnRet = null; foreach (var tn in HtmlTree.Nodes) { var treeNodeEx = tn as TreeNodeEx; tnRet = this.FindNodeExt(treeNodeEx, this.txtUrl.Text); if (tnRet != null) { break; } } tnRet.ForeColor = Color.Red; tnRet.Expand(); }