dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
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: Intermediate
Aug 13, 1999

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Toggle Listview Headers Between Flat and 3-D

Whenever you want a ListView control with flat, nonclickable headers, use this code to toggle the header style. Flat headers don't give users the impression of sortability that 3-D headers do:

 
Private Declare Function GetWindowLong Lib _
	"user32" Alias "GetWindowLongA" (ByVal hWnd _
	As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib _
	"user32" Alias "SetWindowLongA" (ByVal hWnd _
	As Long, ByVal nIndex As Long, ByVal _
	dwNewLong As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const LVM_FIRST = &H1000
Private Const LVM_GETHEADER = (LVM_FIRST + 31)
Private Const HDS_BUTTONS = &H2

Call ToggleHeader(ListView1.hWnd)

Private Sub ToggleHeader(lsvhWnd As Long)
	Dim hHeader As Long, lStyle As Long
	hHeader = SendMessage(lsvhWnd, _
		LVM_GETHEADER, 0, ByVal 0&)
	lStyle = GetWindowLong(hHeader, GWL_STYLE)
	SetWindowLong hHeader, GWL_STYLE, lStyle Xor _
		HDS_BUTTONS
End Sub

Matt Hart
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap
×
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