Rows back and fore color

Posted by: koustubh on 8 September 2017, 1:28 pm EST

  • Posted 8 September 2017, 1:28 pm EST

    Sir i am using windows spread control for dot net 2.0 application.


    While populating data i set the row color as white and fore color as black and brown, but when user clicks the row i want to change the back color and forcolor for that selected row, for that i have written code to set back color as Black and fore color as yellow. When user select the row back color get assign to row but fore color didn't where i am going wrong please tell me.

  • Replied 8 September 2017, 1:28 pm EST

    How and where are you setting the colors up?  Did you try the SelectionBackColor and SelectionForeColor?
  • Replied 8 September 2017, 1:28 pm EST

    Hello Sir,


    While populating spread i am using folowing condition


    if (conditin = true)


    {


    spread.Sheets[0].Rows[row].BackColor = Color.Black;


    }


    else


    {


    spread.Sheets[0].Rows[row].ForeColor = Color.Brown;


    }


     


    it is working fine, After cell click i use the following condition


    spread.Sheets[0].Rows[0, sp_queries.Sheets[0].RowCount - 1].BackColor = Color.White;


    spread.Sheets[0].Rows[0, sp_queries.Sheets[0].RowCount - 1].ForeColor = Color.Black;


    spread.Sheets[0].Rows[row].BackColor = Color.Black;


    spread.Sheets[0].Rows[row].ForeColor = Color.Yellow;


    Here up to first 3 lines results is as per my expectation, but it is not setting fore color as yellow it setting it as a Black. 


     

  • Replied 8 September 2017, 1:28 pm EST

    In the CellClick event I did the following and it is working correctly..

    Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick

    FpSpread1.ActiveSheet.Rows(e.Row).BackColor = Color.Black
    FpSpread1.ActiveSheet.Rows(e.Row).ForeColor = Color.Yellow

    End Sub

Need extra support?

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

Learn More

Forum Channels