|
Thanks for this.
But, while changing to DoubleClick. It doesn't allow it.
Private Sub Control_DoubleClick(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tlvMain.DoubleClick
Is there any workaround to get the index by double clicking it?
modified 20-Sep-12 21:23pm.
|
|
|
|
|
This works just fine for me with VB.Net on VS 2010:
Private Sub tlvMain_MouseDoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) _
Handles tlvMain.MouseDoubleClick
If tlvMain.GetItemAt(e.Location) IsNot Nothing Then
MsgBox(tlvMain.GetItemAt(e.Location).Index)
End If
End Sub
Be aware that almost every control that can contain "dead" or "white" space (area of a control that can, but does not contain an object) can mess up your code if you assume that the user clicked on a node, object, item, etc. For example, on a TreeView control, you have a space that can contain nodes, but may not. The user can interact with this space, so you need to validate objects you want to interact with. Thus, the above If/Then statement that checks to see if there is even a selected node to get properties of. Without these kind of checks, you will have very unstable programs.
modified 21-Sep-12 9:02am.
|
|
|
|
|
I want to alternate the background color of each visible row within the grid.
Currently, I set the background color of each node prior to adding them, but it displays very light and faint in the control. It's almost like the color is being washed out as though it was being displayed through a white object on top of the tree.
What am I doing wrong?
Edit:
I found the answer, the control has a property called "AlphaComponent". It is an overlay transparency factor that overides the alpha value of whatever color you choose. The default is 65 (out of 255 being no transparency vs 0 total transparency). I set the value to 255 and got the color I wanted.
modified 18-Sep-12 17:03pm.
|
|
|
|
|
Hi can you post your code please?
|
|
|
|
|
In Visual Studio, when you select the control on your form, in the "Properties" window for the control is a property called "AlphaComponent" which will have a default value of 65. I simply changed it to 255 to remove any "transparency" (fading) effect.
There was no "code" involved there.
Now, obviously, there a lot of ways of setting properties of the control/nodes
here is just a basic example of creating a node object, setting some properties
and adding it in the first level (root) of the tree:
dim tlvNode as new TreeListNode
dim RootNodeIndex as Integer
tlvNode.Text = "Whatever you want"
tlvNode.BackColor = vbColor.Blue
tlvNode.SubItems.Add("Text for the appropriate column(s)")
RootNodeIndex = TreeListControl.Nodes.Add(tlvNode)
The "AlphaComponent" property of the control will be applied against the color you specify
even if the color already has it's own "alpha" value. If left at the default level of 65, it has a very intense faded effect on highlight, row select and node background colors. Changing it to 255 (no fade effect) caused me to have to set a different "RowSelectColor" value for the control as the default Blue was way to bold without any fading.
|
|
|
|
|
Thanks for this dude.
|
|
|
|
|
I integrated your treelistview code in my VB project and works very well. However I sometime hit a condition where the treelistview disappears and shows a red "X". While debugging the code, I realized that this has to do with scrolling and collapsing the tree, so while the tree is scrolled to a lower position, you try to collapse a node, this causes an issue with a node wanting to be drawn, but it´s outside of the displayable area. I can provide more details, but wanted to know first if you ever came across this issue. Thx, SD
|
|
|
|
|
I got to this point simply by clicking a few times around in the treeview(colapsing and expanding) while horizontal scrollbar is visible..
|
|
|
|
|
If multiple TreeListNodes are selected, and you then right-click on them, the selection clears (unless you're holding down shift/ctrl/whatever).
How can I make this behave like the standard ListView, where the selection is preserved on a right-click?
Thanks!
-Scott
|
|
|
|
|
in the Function _findFirstNode in TreeListView.vb module, correct the bug
Return Me._findFirstNode(aStartingNode.NextSiblingNode, aStartingPoint - ((KidsCount + 1) * 16))
to:
Return Me._findFirstNode(aStartingNode.NextSiblingNode, aStartingPoint - ((KidsCount + 1) * Me.RowHeight))
in order to adapt for RowHeight property
|
|
|
|
|
After selecting a Node, how can one get the Index of the selected Node. Is there any accessible Property?
|
|
|
|
|
I love this control but the one thing I see missing is an auto size function for the columns in the treelistview. I know the normal listview doesn't seem to have it either but it would be great if the columns autosized as the control was resized.
Edit: I found that the regular ListView does have an auto size but when I try it with the TreeListView it doesn't work.
Does anyone have a solution?
modified 21-Jan-12 20:22pm.
|
|
|
|
|
Hi,
i'm need a solution to autoscroll to first selected node.
|
|
|
|
|
<a href=""></a>[<a href="" target="_blank"></<pre lang="sql">A good job done just as the project name "The treelistview to end all treelistviews"! Thanks a lot for your job! Some problems found here.
1.When an item is drag to drop another item, these two items is selected. Then next single-selection becomes a range-selection, just like pressed down shift key.
2.Multiselected drag-n-drop shuld be performed by shift key always pressing down. And the item draged should be the last selected item, or you will lost some items you just selected.</pre>
|
|
|
|
|
Have two images in the image list, and assign the first to the root node and second to the child node. When you expand the root node, the root node's image is changed to the child image.
|
|
|
|
|
In your previous version can be set Checkboxes=Recursive. In this version there is this possibility?
|
|
|
|
|
Hello,
I'm trying to use this control on a VB2010 Express Windows Forms project.
When I drop the TreeListView1 to the form and try to run the program I get the following errors:
(Translated, so this might not 100% fit):
The type 'WinControls.ListView.TreeListView" was not declared. (Form1.Designer.vb)
The assembly "WinControls.ListView" could not be resolved because it depends on...
I don't know how to get this working. Is there a howto somewhere?
Does it depend on a specific .Net Framework? I created a .Net 4.0 project.
Thank you for your help
Dragonminds
|
|
|
|
|
It solves my problem,thanks!
|
|
|
|
|
Hi,
i have a problem with collapsing node with custom control added as subitem on windows 7.
When collapsing node the subitem textbox remain displayed and not collapse.
Hi Marco
TextBox tb = new TextBox();
tb.Text = "test";
tb.BorderStyle = BorderStyle.FixedSingle;
ContainerListViewObject.ContainerListViewSubItem subItem = new ContainerListViewObject.ContainerListViewSubItem();
subItem.Control = tb;
node.SubItems.Add(sub);
|
|
|
|
|
more FAQ, manual - would be great
|
|
|
|
|
My development machine is not using Windows 7 so I have not had the luxury of sitting down and debuging this in detail. It seems that when we begin editing an item in a TreeListView on Windows 7 we trigger an exception in the Paint() method. This is part of the callstack:
Void Insert(System.Object, System.Object, Boolean) : Item has already been added. Key in dictionary: '{X=22,Y=38,Width=16,Height=16}' Key being added: '{X=22,Y=38,Width=16,Height=16}'
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at WinControls.ListView.TreeListView._renderNodeRows(TreeListNode aNode, Graphics aGr, Rectangle Rect, Int32 aTotalRend)
at WinControls.ListView.TreeListView.OnDrawRows(Graphics aGr, Rectangle Rect)
at WinControls.ListView.ContainerListView.OnPaint(PaintEventArgs e)
I blindly modified _renderNodeRows so that it checks to see if the object exists in the hashtable before adding it like this:
<br />
If Not Me._NodeRowRects.Contains(completeItemBounds) Then<br />
Me._NodeRowRects.Add(completeItemBounds, aNode)<br />
End If<br />
But the bug still happens. Anyone else running into this?
|
|
|
|
|
OK, after sitting down on a machine with Windows 7 the code that I thought was causing the problem is not, it's actually the hash table for the _ImageRects that is trying to insert duplicate keys.
|
|
|
|
|
And it does the same for _PlusMinusRects....
I fixed it by testing if these rectangles exist in the hash tables, and if they do, don't add them. It seems to function fine.
|
|
|
|
|
1. I am unable to set font for separate node or subitem. Setting them 'natural' way has no effect - everything is showed same standard font. Same problem with colors: no reaction. How to do it properly? I need to set font.bold just to some specific subitems (not entire columns or 'rows'), and set specific colors.
2. Write to XML works but somehow extremely slowly... in my case unacceptably slowly. Is there any other way to save/load the tree? or how to make WriteXML faster?
2. My project shedule is pressing me hard and i am forced to ask author's, or someone else's (knowing this control better than me) direct help... who could help me? saulius.mikalauskas@ses.lt
Thanks beforehand
|
|
|
|
|
Is there a way to validate user input to a sub item?
If I handle the validating event, The user input is not present yet.
Handling the AfterEdit or Validated events doesn't allow me to cancel the the event if the user has inputted wrong values.
|
|
|
|