Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jun 1, 1999



Application Security Testing: An Integral Part of DevOps

Use Native Trackselect in TreeView and ListView

You can make your TreeView or ListView control behave like a menu so that as you move the mouse cursor over the items, the highlighted item moves with the cursor. Use this code in the TreeView or ListView's MouseMove event:
Private Sub TreeView1_MouseMove(Button _
	As Integer, Shift As Integer, x As _
	Single, y As Single)
	Dim AnyNode As Node

	' HitTest returns a node object 
	' under the cursor
	Set AnyNode = TreeView1.HitTest(x, _

	If Not AnyNode Is Nothing Then
		Set TreeView1.DropHighlight = _
		TreeView1.DropHighlight. _
			Selected = True
	End If
End Sub

Private Sub ListView1_MouseMove(Button _
	As Integer, Shift As Integer, x As _
	Single, y As Single)
	Dim AnyItem As ListItem

	'HitTest returns a node object under 
	'the cursor
	Set AnyItem = ListView1.HitTest(x, _

	If Not AnyItem Is Nothing Then
		Set ListView1.DropHighlight = _
		ListView1.DropHighlight. _
			Selected = True
	End If
End Sub
Arnel J.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date