PDA

View Full Version : Need ghost label to appear over derived TreeView


NoLongerMicah
02-05-2004, 12:54 PM
I have been using a label with the TreeView control - to simulate the ghost image of a node during drag/drop (so that a ghost of the node appears to be floating next to the cursor on a drag/drop).

This works peachy when I had a form that used the TreeView control (from Microsoft.
The time came that I needed to change the TreeView - so I created a control that inherited from the TreeView class.

Now with this derived class, everything works - except for the fact that the "ghost" label will not appear over my derived tree view. I know that I am setting the position right, because if I move the cursor to the far right side of the derived TreeView control I can see the "ghost" label. However the "ghost" label refuses to render itself over the derived TreeView class. I have compared all of the properties between my TreeView and derived TreeView controls and they are the same....

Does anyone have any idea???

Or am I doing this wrong? Is there a way to have the cursor display text and image next to it...??

Thanks very much.
Peter

NoLongerMicah
02-05-2004, 03:21 PM
I placed the label over the control and realized that it's zorder must be behind the control. So I used the "Send to Front" option in the design view to fix the problem.

However, this still doesn't really make me happy. Why doesn't Microsoft allow you to do this programatically through some property? If you create a label control through code (not design view), then how do you set this property to "Bring to Front"????

NoLongerMicah
02-05-2004, 03:48 PM
Duh... I needed the ".BringToFront" method.
Sorry for my stupidness.

One thing I was trying to do was to have a label control inside my derived TreeView class and to have that label control appear in front of the rest of the image. I still couldn't get that to happen - even with the ".BringToFront" method. I guess I will need to pass a reference to the label in via a function, set the ".BringToFront", and manipulate it's position in the derived control.