public override void RenderImageLink(TreeNode node, HtmlTextWriter output) { int indent = node.Indent; //0-based StringBuilder sb = new StringBuilder(); while (indent > 0) //each indent level means one image { bool hasSibling, parentHasSibling, isTop; hasSibling = node.NextSibling() != null; isTop = node.Parent is TreeView; if (node.Parent is TreeNode) { parentHasSibling = ParentHasSibling(node, node.Indent - indent); } else { parentHasSibling = false; } if (node.Indent == indent) //first item in the indent { if (node.HasControls()) //there are children here { string anchorStart, anchorEnd; anchorStart = "<a href=\"" + this.TreeView.Page.GetPostBackClientHyperlink(this.TreeView, node.UniqueID) + "\">"; anchorEnd = "</a>"; if (hasSibling) //down dots { if (node.IsExpanded) //minus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topexpandedsibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middleexpandedsibling.gif' border='0'>" + anchorEnd); } } else //plus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topcollapsedsibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middlecollapsedsibling.gif' border='0'>" + anchorEnd); } } } else //no down dots { if (node.IsExpanded) //minus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topexpandednosibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middleexpandednosibling.gif' border='0'>" + anchorEnd); } } else //plus image { if (IsFirst()) { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "topcollapsednosibling.gif' border='0'>" + anchorEnd); } else { sb.Insert(0, anchorStart + "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middlecollapsednosibling.gif' border='0'>" + anchorEnd); } } } } else // no children { if (hasSibling) { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "middlesiblingnochildren.gif' border='0'>"); } else { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "bottomnosiblingnochildren.gif' border='0'>"); } } } else // prior item in the indent { if (parentHasSibling) { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "vertbardots.gif' border='0'>"); } else { sb.Insert(0, "<img align='top' src='" + this.TreeView.WindowsLafImageBase + "clear.gif' border='0'>"); } } indent--; } output.Write(sb.ToString()); }
public override void RenderImageLink(TreeNode node, HtmlTextWriter output) { int indent = node.Indent; StringBuilder builder = new StringBuilder(); while (indent > 0) { bool flag2; bool flag = node.NextSibling() != null; bool flag3 = node.Parent is TreeView; if (node.Parent is TreeNode) { flag2 = this.ParentHasSibling(node, node.Indent - indent); } else { flag2 = false; } if (node.Indent == indent) { if (node.HasControls()) { string text = "<a href=\"" + base.TreeView.Page.GetPostBackClientHyperlink(base.TreeView, node.UniqueID) + "\">"; string text2 = "</a>"; if (flag) { if (node.IsExpanded) { if (this.IsFirst()) { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "topexpandedsibling.gif' border='0'>" + text2); } else { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "middleexpandedsibling.gif' border='0'>" + text2); } } else if (this.IsFirst()) { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "topcollapsedsibling.gif' border='0'>" + text2); } else { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "middlecollapsedsibling.gif' border='0'>" + text2); } } else if (node.IsExpanded) { if (this.IsFirst()) { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "topexpandednosibling.gif' border='0'>" + text2); } else { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "middleexpandednosibling.gif' border='0'>" + text2); } } else if (this.IsFirst()) { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "topcollapsednosibling.gif' border='0'>" + text2); } else { builder.Insert(0, text + "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "middlecollapsednosibling.gif' border='0'>" + text2); } } else if (flag) { builder.Insert(0, "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "middlesiblingnochildren.gif' border='0'>"); } else { builder.Insert(0, "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "bottomnosiblingnochildren.gif' border='0'>"); } } else if (flag2) { builder.Insert(0, "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "vertbardots.gif' border='0'>"); } else { builder.Insert(0, "<img align='top' src='" + base.TreeView.WindowsLafImageBase + "clear.gif' border='0'>"); } indent--; } output.Write(builder.ToString()); }