469,569 Members | 1,507 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,569 developers. It's quick & easy.

InnerXml in ToolTip

I am showing the InnerXml of a node (in a treeView Control) in a tooltip
,but it is not formatted well ,all the elements after each other ,is there a
way to format the innertext in a tooltip.

=========Code==========

private void tvTreeView_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e){
string strTemp="";
int i=0;
TreeNode tn = this.tvTreeView.GetNodeAt(e.X, e.Y);
if(tn !=null) {
int currentNodeIndex = tn.Index;
if (tn.Text !="subreport") return;
if(currentNodeIndex != oldNodeIndex){
oldNodeIndex = currentNodeIndex;
if(this.tooltipGeneral != null && this.tooltipGeneral.Active)
this.tooltipGeneral.Active = false; //turn it off
XmlDocument sourceDoc = new XmlDocument();
sourceDoc.Load(this.txtFilename.Text);
XmlNodeList subreportNodes = sourceDoc.DocumentElement.ChildNodes;
foreach (XmlNode subreportNode in subreportNodes)
{
if ( i==currentNodeIndex)
{
strTemp=subreportNode.InnerXml;
break;
}
}
else i++;
}
this.tooltipGeneral.SetToolTip(this.tvTreeView, strTemp);
this.tooltipGeneral.Active = true; //make it active so it can show
}
}
}
Nov 16 '05 #1
1 2340
ALI,

You would have to do the formatting yourself.

If you want to do some simple formatting, why not read the current
element, then increment an indent counter (which you keep yourself) when you
move to read the child nodes, and so on, and so on. Then, when done reading
the child nodes, you decrement the indent counter.

Then, you would write out the contents of the node (not the inner xml,
but the node itself), and then prefix the line with the a number of tabs
equal to the indent counter.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ALI-R" <ne****@microsoft.com> wrote in message
news:O9*************@TK2MSFTNGP12.phx.gbl...
I am showing the InnerXml of a node (in a treeView Control) in a tooltip
,but it is not formatted well ,all the elements after each other ,is there
a
way to format the innertext in a tooltip.

=========Code==========

private void tvTreeView_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e){
string strTemp="";
int i=0;
TreeNode tn = this.tvTreeView.GetNodeAt(e.X, e.Y);
if(tn !=null) {
int currentNodeIndex = tn.Index;
if (tn.Text !="subreport") return;
if(currentNodeIndex != oldNodeIndex){
oldNodeIndex = currentNodeIndex;
if(this.tooltipGeneral != null && this.tooltipGeneral.Active)
this.tooltipGeneral.Active = false; //turn it off
XmlDocument sourceDoc = new XmlDocument();
sourceDoc.Load(this.txtFilename.Text);
XmlNodeList subreportNodes = sourceDoc.DocumentElement.ChildNodes;
foreach (XmlNode subreportNode in subreportNodes)
{
if ( i==currentNodeIndex)
{
strTemp=subreportNode.InnerXml;
break;
}
}
else i++;
}
this.tooltipGeneral.SetToolTip(this.tvTreeView, strTemp);
this.tooltipGeneral.Active = true; //make it active so it can show
}
}
}

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Philipp Lenssen | last post: by
3 posts views Thread by Martin Madreza | last post: by
3 posts views Thread by Bas Jaburg | last post: by
reply views Thread by Yves Royer | last post: by
reply views Thread by Yves Royer | last post: by
5 posts views Thread by =?Utf-8?B?cGV0ZTE5Njk=?= | last post: by
2 posts views Thread by =?Utf-8?B?c2VlbWE=?= | last post: by
4 posts views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.