Rows back and fore color

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

  • Posted 8 September 2017, 1:28 pm EST

    <P>Sir i am using windows spread control for dot net 2.0 application.</P>
    <P>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.</P>
  • Replied 8 September 2017, 1:28 pm EST

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

    <P>Hello Sir,</P>
    <P>While populating spread i am using folowing condition</P><FONT size=2>
    <P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (conditin = </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>)</P>
    <P>{</P>
    <P>spread.Sheets[0].Rows[row].BackColor = </FONT><FONT color=#008080 size=2>Color</FONT><FONT size=2>.Black;</P>
    <P>}</P>
    <P></FONT><FONT color=#0000ff size=2>else</P></FONT><FONT size=2>
    <P>{</P>
    <P>spread.Sheets[0].Rows[row].ForeColor = </FONT><FONT color=#008080 size=2>Color</FONT><FONT size=2>.Brown;</P>
    <P>}</P>
    <P> </P>
    <P>it is working fine, After cell click i use the following condition</P><FONT size=2>
    <P>spread.Sheets[0].Rows[0, sp_queries.Sheets[0].RowCount - 1].BackColor = </FONT><FONT color=#008080 size=2>Color</FONT><FONT size=2>.White;</P>
    <P>spread.Sheets[0].Rows[0, sp_queries.Sheets[0].RowCount - 1].ForeColor = </FONT><FONT color=#008080 size=2>Color</FONT><FONT size=2>.Black;</P>
    <P>spread.Sheets[0].Rows[row].BackColor = </FONT><FONT color=#008080 size=2>Color</FONT><FONT size=2>.Black;</P>
    <P>spread.Sheets[0].Rows[row].ForeColor = </FONT><FONT color=#008080 size=2>Color</FONT><FONT size=2>.Yellow;</P>
    <P></FONT>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. </P>
    <P> </P></FONT>
  • Replied 8 September 2017, 1:28 pm EST

    <p>In the CellClick event I did the following and it is working correctly..</p><p>Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick<br><br>FpSpread1.ActiveSheet.Rows(e.Row).BackColor = Color.Black<br>FpSpread1.ActiveSheet.Rows(e.Row).ForeColor = Color.Yellow<br><br>End Sub <br></p>
Need extra support?

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

Learn More

Forum Channels