in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Re: Colored cell

Last post 01-29-2007 2:09 PM by hesaigo999ca. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-24-2006 6:25 AM

    Re: Colored cell

    Hello,

    I want to know if there is a possibility to colore a cell of a flexgrid
    according to whats it contains and on which event will you do it.

    Samuel
  • 10-13-2006 9:08 AM In reply to

    Re: Colored cell

    Hi Samuel,
     
    If you are using a databound flexgrid, then whenever we make any change in flexgrid, it fires an AfterDataRefresh event, so i would suggest you to capture this event and then you can check the value in a cell and set the background color of the cell.
     
    below is a code snippet:
    Dim cs As C1.Win.C1FlexGrid.CellStyle

    cs = C1FlexGrid1.Styles.Add("back_color")

    Private Sub C1FlexGrid1_AfterDataRefresh(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles C1FlexGrid1.AfterDataRefresh

    If C1FlexGrid1.Item(1, 1) = "Jack" Then

    cs.BackColor = Color.Red

    C1FlexGrid1.SetCellStyle(1, 1, cs)

    End If

    End Sub

    you can also try the validateedit, validating and validated events as per your requirement.

    Regards,

    John Adams

    <Cmoi_sam> wrote in message news:184081@test.componentone.com...
    Hello,

    I want to know if there is a possibility to colore a cell of a flexgrid
    according to whats it contains and on which event will you do it.

    Samuel

    http://home.componentone.com/cs/forums/184081/ShowPost.aspx

  • 01-29-2007 2:09 PM In reply to

    Re: Colored cell

    what if you are using a tdbgrid and you do not use the event fetchrowstyle or the like.
    Lets say you just want to update the backcolor of the cell by doing something like
    i think should look like this...
    c1tdbgrid1[4,7].SetCellBackColor(System.Drawing.Color.Red);
    or something like this...
    This would be very handy to know as every example is alwasy to do with firing events or
    setting a whole row or a selected cell....
    I just want to set the color of cell 2,6 and be done with it...no having to do alot of useless stuff...it this possible???


Page 1 of 1 (3 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.