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. Alternate background color for column with TableStyle / GridColumnStyle

Alternate background color for column with TableStyle / GridColumnStyle

Scheduled Pinned Locked Moved Visual Basic
help
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.
  • J Offline
    J Offline
    Johan Hakkesteegt
    wrote on last edited by
    #1

    Hi, I have a datagrid that needs to show different columns with different widths. So I use TableStyles and GridColumnStyles, no problem. There are approximately 12 columns, three of which I need to visually jump out. So I figure I'll just make the font for these columns bold, or better yet, change the background color for these three columns only. But there is neither a font nor a background color property in the GridColumnStyle. Apparently I just don't know what to ask for in google, or I am the only person in the world who needs differently colored columns, because all I found was ways to change the background color and/or font of a cell / column when it is activated / clicked on / entered. Any suggestions at all appreciated. Johan

    My advice is free, and you may get what you paid for.

    S 1 Reply Last reply
    0
    • J Johan Hakkesteegt

      Hi, I have a datagrid that needs to show different columns with different widths. So I use TableStyles and GridColumnStyles, no problem. There are approximately 12 columns, three of which I need to visually jump out. So I figure I'll just make the font for these columns bold, or better yet, change the background color for these three columns only. But there is neither a font nor a background color property in the GridColumnStyle. Apparently I just don't know what to ask for in google, or I am the only person in the world who needs differently colored columns, because all I found was ways to change the background color and/or font of a cell / column when it is activated / clicked on / entered. Any suggestions at all appreciated. Johan

      My advice is free, and you may get what you paid for.

      S Offline
      S Offline
      Smithers Jones
      wrote on last edited by
      #2

      you have to do the drawing yourself by deriving from datagridtextboxcolumn and then overriding the paint-method. i found this c#-article being helpful: Changing the background color of cells in a DataGrid[^]

      "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

      J 1 Reply Last reply
      0
      • S Smithers Jones

        you have to do the drawing yourself by deriving from datagridtextboxcolumn and then overriding the paint-method. i found this c#-article being helpful: Changing the background color of cells in a DataGrid[^]

        "I love deadlines. I like the whooshing sound they make as they fly by." (DNA)

        J Offline
        J Offline
        Johan Hakkesteegt
        wrote on last edited by
        #3

        I owe you my gratitude ! I can't say I have it figured out completely yet, but you have certainly managed to point me in the right direction, and given me a little push to boot, thanks. Johan

        My advice is free, and you may get what you paid for.

        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