[RESOLVED] Checkbox enabled Treeview Bug - workaround !!
So i'm using a treeview with checkbox's enabled, and via some customization I'm only enabling the checkbox's on the root nodes (see attached pic), which was actually not too difficult, and not the issue here..
There is a serious bug in the Checkbox Double Click.. Dbl Clicking on the Checkbox itself and not the node text, presents some interesting issues. I've done many hours of coding and recoding and trapping, and this is what i have worked out so far..
The double Clicking on the Checkbox acts very much like a Dbl click hold... Ie. Click, Release, Click, Hold.. A third Click on the checkbox does the final release of the Dbl click... NOW.. this bug has been reported to MS earlier this year ... (MS connect thread here) and MS has simply shrugged it off with a
IE... we just not interested in fixing this BUG, and go find a workaround...
Thank you for reporting this issue. -- We have evaluated the issue that you have reported and at this point in the product's lifecycle, it does not meet the criteria to be addressed.
After some searching.. i found this thread with a workaround.. Ohhhhh shucks it's in C again...
So here's the VB.NET equivalent....
Now what i did was add a new project to the solution called 'MyTreeView', with just the single class (you may need to add the System.Windows.Forms .NET reference to the project.)
Public Class MyTreeView
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = &H203 Then
Dim LocalPos = PointToClient(Cursor.Position)
Dim hitTestInfo = HitTest(LocalPos)
If (hitTestInfo.Location = TreeViewHitTestLocations.StateImage) Then
m.Result = 0
Compiled the project, then added the 'MyTreeView' project as a reference to the project where i needed the treeview, then simply used Mytreeview.mytreeview instead of system.windows.forms.treeview object..
This effectively completely disables Dbl clicking on the treeview checkbox, but dbl clicking on the node will expand and collapse the nodes..
Friend WithEvents TVModules As MyTreeView.MyTreeView
Me.TVModules = New MyTreeView.MyTreeView
Me.TVModules.CheckBoxes = True
Me.TVModules.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll
Me.TVModules.Location = New System.Drawing.Point(81, 32)
Me.TVModules.Name = "TVModules"
Me.TVModules.ShowNodeToolTips = True
Me.TVModules.Size = New System.Drawing.Size(575, 199)
Me.TVModules.TabIndex = 54
I hope someone else gets some joy, and relief with this...
Re: [RESOLVED] Checkbox enabled Treeview Bug - workaround !!
Nice post! :thumb: Thanks for sharing the workaround