Re: TreeView Trouble

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I would do all this by subclassing listview only. It will be easier to
immitate a tree in the left column of the listview then to syncronize
between the tree view and the list view.

And looks like you are using .NET Framework, and this newsgroup is for Win32
API disucssions so it might be helpful to ask in one of
microsoft.public.dotnet.framework.* newsgroups.

"L. Spiro" <LSpiro@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:30866166-53BC-4667-A9F6-8BD847F8CF39@xxxxxxxxxxxxxxxx
GOAL:
I am making a useful new control.

It is like a listview control (list style with headers), but the first
column is a treeview rather than the normal listview, and each following
column will have extra text related to the treeview item. These extra
columns of text are displayed only when the related treeview item is
displayed.

To do this I am creating a custom control that has inside it a treeview
control and a header control.
The header aligns the top like in a listview control and the treeview is
supposed to be snugly fit into the first column (whose width is defined by
the first header item width).
The areas to the right of the treeview where the text will be display will
be drawn by my custom control.



THE PROBLEM:
Scrollbars.

My custom control has its own scrollbars and I want to use those for the
entire control.
But when I disable scrollbars on the treeview it won't scroll, and there
is
nothing I can do about it. I already subclassed, then disassembled its
drawing routine, trying to find where it gets the offset from which to
draw
the first item, but although I found the treeview's data block I did not
find
any numerical offsets used for drawing items higher and lower.



MY SOLUTIONS:
#1:
My initial solution was to simply size the treeview so that its top is
higher than my control so the items would be drawn higher and I scrolled
down, but unfortunately controls have a limit to size and after a few
thousand items are added it simply disappears.

#2:
If I give the scrollbars back to the treeview I can keep its size normal
and
send scroll messages to make it scroll up and down in sync with my custom
control.
However, the obvious flaw here is that there are now two sets of
scrollbars.

This solution allows me to keep the treeview sized correctly, and it is
preferred, if I can find a way to prevent its scrollbars from being drawn.
I
looked but could not find.

#3:
I am currently sizing to treeview just large enough so that its scrollbars
are outside of my custom control altogether, so they will not be drawn and
I
can send commands to scroll it in sync with my custom control.
I am sublclassing it and clipping out the areas where it is not supposed
to
be drawn so there is no flicker over the text areas.

This causes me to resize the treeview twice when the bottom scrollbar is
shown.
First I must resize to the width and then check if the bottom scrollbar is
being shown, then resize again to put it out of view.
It may also cause problems accepting input over the text areas to the
right,
though I am not there yet.



Is it possible to use #2 but to prevent the scrollbars from being drawn?



.



Relevant Pages

  • Re: May I introduce myself to cobol?...
    ... Treeview styles, ... Enables check boxes for items in a tree-view control. ... a state image list containing two images. ... Process the NM_CUSTOMDRAW message using the same logic as shown my listview ...
    (comp.lang.cobol)
  • TreeView Trouble
    ... I am making a useful new control. ... column will have extra text related to the treeview item. ... The header aligns the top like in a listview control and the treeview is ... My custom control has its own scrollbars and I want to use those for the ...
    (microsoft.public.win32.programmer.ui)
  • Using Splitter!!!
    ... how to use the Splitter Control. ... // Create TreeView, ListView, and Splitter controls. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Using Splitter!!!
    ... // Create TreeView, ListView, and Splitter controls. ... // Set the Splitter to dock to the left side of the TreeView control. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: ListView to TreeView drag and drop question.
    ... What I am attempting to do is to get the row data from the ListView and drag ... it to a TreeView node (similar to Windows Explorer when dropping files into ... >> the TreeView control or the node. ...
    (microsoft.public.vb.controls)