Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Listview

1.) Is there a way that the whole line becomes selected when I select a row in report mode ?
     Only the first column items get selected, not the subitems.

2.) Is there a way to use different colors for different rows ?

 
0
tstrob
Asked:
tstrob
  • 3
  • 3
1 Solution
 
GefflCommented:
To select the entire row you just have to make a simple API call:
Declaration:
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
       (ByVal hwnd As Long, _
       ByVal Msg As Long, _
       ByVal wParam As Long, _
       ByVal lParam As Long) As Long
       Public Const FIRSTADR = &H1000
       Public Const SETEXTLVSTYLE = FIRSTADR + 54
       Public Const GETEXTLVSTYLE = FIRSTADR + 55
       Public Const FULLROWSEL = &H20
Then use as follows:
       Dim Style As Long
       Dim x As Long
       'check Style
       Style = SendMessageLong(ListView.hwnd, GETEXTLVSTYLE, 0&, 0&)
       
       'to remove the FullRowSelection:
       Style = Style Xor FULLROWSEL
       'to set the FullRowSelection
       Style = Style Or FULLROWSEL
       'To apply just call
       r = SendMessageLong(ListView.hwnd, SETEXTLVSTYLE, 0&, Style)
Have fun
0
 
tstrobAuthor Commented:
Geffl,

thank you. This works.
Do you (or someone else) has an idea for the colors ?
0
 
GefflCommented:
I don´t know how to set different colors. But if it´s enough you can set Gridlines in the same way. Just Or with &H1 , Xor with &H1 (Define a global const for &H1: EXTLVGRID)
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
tstrobAuthor Commented:
Geffl,

thank you. This works.
Do you (or someone else) has an idea for the colors ?
0
 
tstrobAuthor Commented:
Geffl,

is there also a way to forbid the user to resize the columnheaders ?

tnx
0
 
GefflCommented:
I don´t think so. For such things it would be better to use a third party grid control.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now