المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Floating child form linked to Treemap nodes



C# Programming
03-13-2010, 03:51 AM
I'm quite new to c# and dot.net. I've been scratching my head on this one for quite a while. I'm trying to build functionality similar to that shown here:

http://finviz.com/forex.ashx

I'm using the treemap code. I'm using the the text from the e.node.tooltip to disquish when the mouse hovers over a different node. I want to create a new child form that tracks the cursor like that shown in the above example. When the cursor passes over a new nodes I want to close the currently displayed form and display a new form associated with the node the mouse cursor is now hovering over. Here is were I capture the mouseover event:

void tmcMap_NodeMouseHover(object sender, NodeEventArgs e)
{
Form2 frmForm2 = new Form2();
if (e.Node.ToolTip != lastValue && frmForm2.Created != true)
{
lastValue = e.Node.ToolTip;

frmForm2.Text = "Child " + e.Node.ToolTip;
frmForm2.SetDesktop********(Cursor.Position.X, Cursor.Position.Y);
frmForm2.Show();
}

)

My problem is how to close frmForm2 prior to creating a new frmForm2 when the cursor hovers over a different node?

Any help would be appreciated!