dcsimg
Results 1 to 6 of 6

Thread: MSFlexGrid won't allow black BackColor for a regular cell.

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2018
    Posts
    8

    MSFlexGrid won't allow black BackColor for a regular cell.

    The code
    Code:
    grid1.CellBackColor = RGB(0,0,0)
    sets the back color of a cell to White. Using vbBlack instead of RGB does the same. Setting it to any other color works fine, including RGB(255,255,255) or vbWhite which also sets it to White

    Setting GridColorFixed to Black works, but not setting a single, regular cell to Black.

    [A last-second idea just before posting this message got me to try RGB(0,0,1), thinking that might be close enough to Black for my purposes and it is, but I would still like to know why vbBlack and RGB(0,0,0) won't work.]

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,247

    Re: MSFlexGrid won't allow black BackColor for a regular cell.

    I remember that I had the same problem once. I believe I used RGB(1,1,1) instead of Black
    It seems 0 is used for the default color, as having no cell backcolor

  3. #3
    Frenzied Member
    Join Date
    Feb 2017
    Posts
    1,257

    Re: MSFlexGrid won't allow black BackColor for a regular cell.

    Yes, RGB (0, 0, 0) = 0
    vbBlack is also = 0

    In MSFlexGrid, 0 for CellBackColor means 'not set'. Unlike MSHFleXGrid where it works.

    With MSFlexGrid you could use a system color that is usually black, like vbWindowText or use a color very near to black as suggested by Arnoutdv.
    vbExtra: Print preview for VB6, print FlexGrids and more.
    MSDN online for VB6, Language reference.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,367

    Re: MSFlexGrid won't allow black BackColor for a regular cell.

    "Usually black" is really the key to this entire kerfluffle.

    The system color palette exists for a reason, primarily to help enforce the use of color conventions in order to keep things from becoming unreadable when non-default themes are used.

    One reason for such themes is compliance with accessibility laws.

    Just stop trying to use color for things it isn't intended for and these problems go away.

    When selecting system colors, match but don’t mix is a brief classic on this topic.

    Considerations around the accessibility of a calendar control is longer, but interesting in the way it delves into this more deeply.

    There isn't any simple answer but there is a simple takeaway: don't use arbitrary colors as indicators in user interfaces.

  5. #5
    Frenzied Member
    Join Date
    Feb 2017
    Posts
    1,257

    Re: MSFlexGrid won't allow black BackColor for a regular cell.

    Quote Originally Posted by dilettante View Post
    "Usually black" is really the key to this entire kerfluffle.

    The system color palette exists for a reason, primarily to help enforce the use of color conventions in order to keep things from becoming unreadable when non-default themes are used.

    One reason for such themes is compliance with accessibility laws.

    Just stop trying to use color for things it isn't intended for and these problems go away.

    When selecting system colors, match but don’t mix is a brief classic on this topic.

    Considerations around the accessibility of a calendar control is longer, but interesting in the way it delves into this more deeply.

    There isn't any simple answer but there is a simple takeaway: don't use arbitrary colors as indicators in user interfaces.
    Yes, it is a good practice to stick to the system colors.
    But in this case, in the system palette there is not background color that is usually black.
    He'll need to invert background and foreground colors if he wants to stick to the system colors, like using vbWindowsText for the CellBackColor and vbWindowBackGround for CellForeColor.

    You may say why not to use vbHighlight and vbHighlightText instead...
    Perhaps he wants a black background, he could have a valid reason to want a black background of a cell I think...

    Lately not even MS is fully complying with these recommendations. For example in their Groove music program they don't use system colors AFAIK.
    vbExtra: Print preview for VB6, print FlexGrids and more.
    MSDN online for VB6, Language reference.

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2018
    Posts
    8

    Re: MSFlexGrid won't allow black BackColor for a regular cell.

    Quote Originally Posted by dilettante View Post
    The system color palette exists for a reason, primarily to help enforce the use of color conventions in order to keep things from becoming unreadable when non-default themes are used.
    In my system, I use Red for the Active Title Bar in hopes that I'll notice which window is going to be affected when I start pushing keys. At the same time I was having this problem, I tried using the "Active Title Bar" color and it didn't give me Red. It gave me Blue.

    So since it didn't seem to work, I went back to using palette colors.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width