Listview Indivual Column Colors

Hello, Im trying to make it so in listview1 i can have a specfic line a specfied color.
clear100-comAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

clear100-comAuthor Commented:
An example of what im looking for is this: http://codeguru.earthweb.com/listview/row_color.shtml

However that is C++ code.
0
clear100-comAuthor Commented:
This is what im looking for, but what is subclassing?
0
EDDYKTCommented:
listview1.listsubitem(1).forecolor = vbred
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

EDDYKTCommented:

listview1.listsubitems(1).forecolor = vbred

where listview1 is listitem
0
clear100-comAuthor Commented:
No, im looking for the background....
0
clear100-comAuthor Commented:
OK, i figured it out, please do not post any more comments in this session:
modListViewColorize:
======================
Option Explicit
Public Enum ImageSizingTypes
   [sizeNone] = 0
   [sizeCheckBox]
   [sizeicon]
End Enum
Public Enum LedgerColours
  vbledgerWhite = &HF9FEFF
  vbLedgerGreen = &HD0FFCC
  vbLedgerYellow = &HE1FAFF
  vbLedgerRed = &HE1E1FF
  vbLedgerGrey = &HE0E0E0
  vbLedgerBeige = &HD9F2F7
  vbLedgerSoftWhite = &HF7F7F7
  vbledgerPureWhite = &HFFFFFF
End Enum
Public Const LVM_FIRST As Long = &H1000
Public Const LVM_SETCOLUMNWIDTH As Long = (LVM_FIRST + 30)
Public Const LVSCW_AUTOSIZE As Long = -1
Public Const LVSCW_AUTOSIZE_USEHEADER As Long = -2
Public Declare Function SendMessage Lib "user32" _
   Alias "SendMessageA" _
  (ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   lParam As Any) As Long


Public Sub SetListViewLedger(lv As ListView, _
                              Bar1Color As LedgerColours, _
                              Bar2Color As LedgerColours, _
                              nSizingType As ImageSizingTypes, _
                              frm As Form, _
                              ListV As ListView, _
                              ImgL As ImageList, _
                              Pict As PictureBox)

   Dim iBarHeight  As Long
   Dim lBarWidth   As Long
   Dim diff        As Long
   Dim twipsy      As Long
   
   iBarHeight = 0
   lBarWidth = 0
   diff = 0
   
   On Local Error GoTo SetListViewColor_Error
   
   twipsy = Screen.TwipsPerPixelY
   
   If lv.View = lvwReport Then
   
     
      With lv
        .Picture = Nothing
        .Refresh
        .Visible = 1
        .PictureAlignment = lvwTile
        lBarWidth = .Width
      End With  ' lv
       
      With Pict
         .AutoRedraw = False
         .Picture = Nothing
         .BackColor = vbWhite
         .Height = 1
         .AutoRedraw = True
         .BorderStyle = vbBSNone
         .ScaleMode = vbTwips
         .Top = Form1.Top - 10000
         .Width = Screen.Width
         .Visible = False
         .Font = lv.Font
         
         With .Font
            .Bold = lv.Font.Bold
            .Charset = lv.Font.Charset
            .Italic = lv.Font.Italic
            .Name = lv.Font.Name
            .Strikethrough = lv.Font.Strikethrough
            .Underline = lv.Font.Underline
            .Weight = lv.Font.Weight
            .Size = lv.Font.Size
         End With
         iBarHeight = .TextHeight("W")
         Select Case nSizingType
            Case sizeNone:
               iBarHeight = iBarHeight + twipsy
               
            Case sizeCheckBox:
               If (iBarHeight \ twipsy) > 18 Then
                  iBarHeight = iBarHeight + twipsy
               Else
                  diff = 18 - (iBarHeight \ twipsy)
                  iBarHeight = iBarHeight + (diff * twipsy) + (twipsy * 1)
               End If
               
            Case sizeicon:
               diff = ImgL.ImageHeight - (iBarHeight \ twipsy)
               iBarHeight = iBarHeight + (diff * twipsy) + (twipsy * 1)
               
         End Select
     
         .Height = iBarHeight * 2
         .Width = lBarWidth
         Pict.Line (0, 0)-(lBarWidth, iBarHeight), Bar1Color, BF
         Pict.Line (0, iBarHeight)-(lBarWidth, iBarHeight * 2), Bar2Color, BF
     
         .AutoSize = True
         .Refresh
         
      End With
      lv.Refresh
      lv.Picture = Pict.Image
     
   Else
   
      lv.Picture = Nothing
       
   End If

SetListViewColor_Exit:
On Local Error GoTo 0
Exit Sub
   
SetListViewColor_Error:

   With lv
      .Picture = Nothing
      .Refresh
   End With
   
   Resume SetListViewColor_Exit
   
End Sub
Public Sub lvAutosizeControl(lv As ListView)

   Dim col2adjust As Long
 For col2adjust = 0 To lv.ColumnHeaders.Count - 1
   
      Call SendMessage(lv.hwnd, _
                       LVM_SETCOLUMNWIDTH, _
                       col2adjust, _
                       ByVal LVSCW_AUTOSIZE_USEHEADER)

   Next
   
   
End Sub
======================
form1:
======================

Private Sub Form_Load()
   Command1.Caption = "Text Only"
End Sub
Private Sub Command1_Click()
   With ListView1
    .ListItems.Add 1, , , , 1
    .ListItems(1).SubItems(1) = "test"
      .Visible = False
      .Checkboxes = False
      .FullRowSelect = True
      Call SetListViewLedger(ListView1, _
                             vbLedgerYellow, _
                             vbLedgerGrey, _
                             sizeicon, Me, ListView1, ImageList1, TestPicture)
      .Refresh
      .Visible = True
   End With
End Sub
=============


Found this info from: http://www.mvps.org/vbnet/code/comctl/lvledger.htm
Requesting to lock this question to refund points, but to keep fourm up...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YensidModCommented:
Question is PAQed and 20 points refunded.

YensidMod
Experts Exchange Moderator
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

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.