Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. OnPaintBackGround ListView

OnPaintBackGround ListView

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lespaul36
    wrote on last edited by
    #1

    I wanted to override the onpaintbackground of my listview control, but it never seems to be invoked. Is there a way I can cause it to invoke..maybe getting a message from WndProc. If so, what message?

    P 1 Reply Last reply
    0
    • L lespaul36

      I wanted to override the onpaintbackground of my listview control, but it never seems to be invoked. Is there a way I can cause it to invoke..maybe getting a message from WndProc. If so, what message?

      P Offline
      P Offline
      progload
      wrote on last edited by
      #2

      I'm kind of at a loss of what your trying to do with the listview, the vb.net listview has a backcolor and picture properties. If you are you trying to add colors to the sub items, you'll need to set the listviewitem "UseItemStyleForSubItems" property to false: ' Make a ListView row. Private Sub ListViewMakeRow(ByVal lvw As ListView, ByVal item_title As String, ByVal ParamArray subitem_titles() As String) ' set the listviw back color lvw.BackColor = Color.LightGoldenrodYellow ' Make the item. Dim new_item As ListViewItem = lvw.Items.Add(item_title) 'must set useritemstyleforsubitems = false to change color new_item.UseItemStyleForSubItems = False ' Make the sub-items. For i As Integer = subitem_titles.GetLowerBound(0) To subitem_titles.GetUpperBound(0) new_item.SubItems.Add(subitem_titles(i), Color.Black, Color.AliceBlue, Font) Next i End Sub I hope this helps

      L 1 Reply Last reply
      0
      • P progload

        I'm kind of at a loss of what your trying to do with the listview, the vb.net listview has a backcolor and picture properties. If you are you trying to add colors to the sub items, you'll need to set the listviewitem "UseItemStyleForSubItems" property to false: ' Make a ListView row. Private Sub ListViewMakeRow(ByVal lvw As ListView, ByVal item_title As String, ByVal ParamArray subitem_titles() As String) ' set the listviw back color lvw.BackColor = Color.LightGoldenrodYellow ' Make the item. Dim new_item As ListViewItem = lvw.Items.Add(item_title) 'must set useritemstyleforsubitems = false to change color new_item.UseItemStyleForSubItems = False ' Make the sub-items. For i As Integer = subitem_titles.GetLowerBound(0) To subitem_titles.GetUpperBound(0) new_item.SubItems.Add(subitem_titles(i), Color.Black, Color.AliceBlue, Font) Next i End Sub I hope this helps

        L Offline
        L Offline
        lespaul36
        wrote on last edited by
        #3

        I am recreating a Windows Explorer control. I am stuck at making the selected column (when in details view) have a different color. I was hoping that maybe I could paint the rectangle when the packground was painted and the items would still paint alright. I am just trying about anything I can think of or find close on the internet.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups