Results 1 to 4 of 4

Thread: Set font, color for ListviewItem? [resolved]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164

    Set font, color for ListviewItem? [resolved]

    PHP Code:
    Dim lViewItem As New ListViewItem()

    lViewItem.SubItems.Add(chr(252), System.Drawing.Color.RedSystem.Drawing.Color.Green, New System.Drawing.Font("Wingdings"10))

    Me.myListView.Items.Add(lViewItem
    Why doesn't this work?

    I get the chr(252) character of the default font (MS Sans) and the background and foreground are the default (white/black) colors?

    The background/foreground isn't important and I will change them back to white/black, but even that isn't working.

    thanks,
    Last edited by Shurijo; Aug 29th, 2003 at 10:13 AM.
    -Shurijo

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164
    Ok. I found out that I have to set the entire Item to the same background, foreground, font properties. A subitem (even thou it is possible via code) cannot have different properties than the item.

    So this isn't "resolved", it's just impossible (unless using a custom control, etc.).
    -Shurijo

  3. #3
    Lively Member
    Join Date
    Jan 2002
    Posts
    105
    By default the listview subitems use the same font, style & color as the listitem to turn it off, do it like this.....

    Code:
    itm.UseItemStyleForSubItems = False
                itm.SubItems(1).Font = New Font("Tahoma", 9.0!, _
                            System.Drawing.FontStyle.Italic)
    I'll leave the rest up to you to work out.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Posts
    164

    Talking

    THANKS!
    -Shurijo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width