Question TreeView display positioning

pbturner

New member
Joined
Jan 28, 2016
Messages
2
Programming Experience
10+
I have a TreeView (System.Windows.Forms.TreeView) control on a custom control (similar to the Output window in visual studio 2013). that control is placed at the bottom of a main form (like the visual studio ide). when i populate this TreeView control with data, it fills correctly, but, if the containing control is close to the bottom, the displayed "popup" is cut off. if i expand the lower control to have more room, the control displays with all the data. the display is "docked" to where it was designed. i tried putting a scrollbar on the display (which worked), but this is not the desired/requested behavior.

what i would like to do is to either have the display "go up", if necessary, like the "Show output from:" display on the Output window in Visual Studio 2013, or, simply have the display be FreeFloating.

any suggestions would be greatly appreciated.

thanks in advance.

pete.
 
update

I have a TreeView (System.Windows.Forms.TreeView) control on a custom control (similar to the Output window in visual studio 2013). that control is placed at the bottom of a main form (like the visual studio ide). when i populate this TreeView control with data, it fills correctly, but, if the containing control is close to the bottom, the displayed "popup" is cut off. if i expand the lower control to have more room, the control displays with all the data. the display is "docked" to where it was designed. i tried putting a scrollbar on the display (which worked), but this is not the desired/requested behavior.

what i would like to do is to either have the display "go up", if necessary, like the "Show output from:" display on the Output window in Visual Studio 2013, or, simply have the display be FreeFloating.

any suggestions would be greatly appreciated.

thanks in advance.

pete.

RESOLVED:
- create 3 new variables ... originalParent, originalLocation, and firstTime.
- in the Resize method (which is called from a mouseOver event), where the size of the display is set, if this is the first time, save off the above and set the parent to the TopLevelControl
- determine the new location on the form ... originalParent.FindForm().PointToClient(originalParent.PointToScreen(originalLocation).
- see if the displayed output would go beyond the end of the top form ... TopLevelControl.DisplayRectangle.Height - (locationOnForm.Y + oTreeView.DisplayRectangle.Height)
- if the difference is less than 0, adjust the new location.Y by the difference.
- set the display output Location to the new location

presto ...

- also, added a method so that when the main form is resized, or the containing control is repositioned, the location is set using the info above - just not adjusting for the display output height.
- add a call to the reset in the mouseLeave event
 
Back
Top Bottom