the cell's backcolor is invalid when the row is selected.

Originally Posted 18 September 2011, 4:51 am EST

  • Originally Posted 18 September 2011, 4:51 am EST

    Hi.
    I use .Cell(flexcpBackColor,... ) to change a cell's bakccolor,
    but when the row is seleted, then the cell's backcolor is lost, the backcolor is now the vsflexgrid's backcolorsel.

    How to keep the cell's backcolor when the row is seleted?

    Thanks!
  • Reply

    Hi,

    I can't replicate exactly what you are doing, if I use something like this

    Private Sub Command1_Click()
    fg.Cell(flexcpBackColor, 2, 2) = vbGreen
    'fg.BackColorSel = vbGreen
    End Sub


    The the cell(2,2) would have a green background and on selection it would be overridden by the default selection color. However if you have defined somewhere the fg.BackColorSel then the HIGHLIGHT color would be overridden by the BackColorSel property

    Let me know what you are trying to do ,may be some sample or the steps exactly would be helpful in narrowing it down

    Also if you can check the scenario with latest build, if you ain't using that.

    http://prerelease.componentone.com/activex/C1FlexGrid/C1FlexGrid%208.0/2011-T2/vsflex8_8.0.20112.286.zip

    Regards
    ~Gatim
  • Reply

    Thanks for your reply.
    Please see the attachment.
    I set the cell (1,1)'s backcolor to red, but when there are only one row,
    user can't see the cell 's red backcolor.
    Thanks!
    2011/10/test.zip
  • Reply

    Hi,

    You may either put the BackColorSel property to same as the back cell color

    Private Sub Form_Load()
    ClearVSGrid VSFlexGrid1
    With VSFlexGrid1
    .AddItem vbNullString
    .TextMatrix(1, 1) = "a"
    .Cell(flexcpBackColor, 1, 1) = vbRed
    .Select 1, 1, 1, .Cols - 1 'you can see,After select the first row, the cell(1,1) backcolor is not red, but user need see the red backcolor whether select it or not.
    .ShowCell 1, 1
    .BackColorSel = vbRed ' Either use this to make
    '.HighLight = flexHighlightNever 'Or avoid the selection as the highlight color property would always over ride the back color property

    End With
    End Sub

    Regards
    ~Gatim
  • Reply

    Thanks for your replay!

    But whether
    .BackColorSel = vbRed ' Either use this to make

    or
    '.HighLight = flexHighlightNever

    is not what I need.

    I hope it can be the style as attachment need.jpg, I hope can use the cell's backcolor to cover the selected row's backcolor, not use the selected row's backcolor to cover the cell's backcolor, how can I do?

    Thanks!

  • Reply

    Hi,

    You can set the HighLight property of the FlexGrid to flexHighlightNever, but that alone will show no indication that anything has been selected.

    You can use the DrawCell event to create a border for the selected row, so that you can see that something has been selected and see the cell formatting. I have updated a sample to show this.

    Regards
    ~Gatim
    2012/01/VSFlex_test.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels