C1FlexGridClassic CellPropertySettings.flexcpBackColor doesn't work correctly!

Posted by: samo3889 on 2 January 2018, 2:36 am EST

  • Posted 2 January 2018, 2:36 am EST

    Hi All,

    i use C1FlexGridClassic

    i try to paint all grid in gray color and row 7 in Red color and row 8 in Blue color
    but it Not painting correctly
    look at the following attachment (BackColorExample

    Thanks,
    Saleem

    BackColorExample.zip
  • Replied 2 January 2018, 5:21 pm EST

    Hi Saleem!

    I have modified your sample, demonstrating the use of set_Cell method with flexcpBackColor setting. Please refer to the attached sample.

    Prj_BackColor.zip

    Best,
    Meenakshi
  • Replied 2 January 2018, 7:35 pm EST

    hi Meenakshi,

    first of all thanks for suggest solution , but i have code vb6 and i want to convert it to c# without change any logic . can i do that ?
    there any another way to solve it ? in same logic ?

    thanks,
    saleem
  • Marked as Answer

    Replied 3 January 2018, 4:43 pm EST

    Hi Saleem!

    In VB6, you can use the same logic with FlexcpBackColor in Cell property of VSFlexGrid. Please see the given help link :
    http://help.grapecity.com/componentone/NetHelp/vsflexgrid8/cellproperty.html

    This should help you.

    Best regards,
    Meenakshi
  • Replied 16 November 2020, 12:04 am EST

    hi Meenakshi,
    this doesn't work for me. Alle rows are gray now. The Problem is that the last row of command overwrite all rows and cols.
    It does not matter what I specify as row1, col1, row2, col2. All rows and columns are always set with the given color.
    Please help.

  • Replied 17 November 2020, 5:59 pm EST

    Hi Dev,

    The previous sample attached in this post works as expected at our end. Please see the attached screenshot for reference and if you are doing anything else then please let us know and modify the attached sample accordingly.
    Also, let us know the build version of the control that you are using at your end so that we can help you better.

    Note: The control C1FlexGridClassic is a very old control and has been in maintenance mode since very long so I would recommend you to use the C1FlexGrid control. You can learn more about this control from the following documentation link:
    https://www.grapecity.com/componentone/docs/win/online-flexgrid/overview.html
    If you face any issue in using the control, then please let us know.

    Regards,
    Prabhat Sharma.
    Prj_BackColor_Mod.zip
  • Replied 17 November 2020, 8:45 pm EST

    Hi prabhat.sharma,
    first of all, I would like to thank you for your quick response.
    You can reproduce the problem I have with the following lines of code.

    Regards

                //Set Backcolor for all rows and columns to Color Red
    c1FlexGridClassic1.set_Cell(CellPropertySettings.flexcpBackColor, 1, 1, c1FlexGridClassic1.Rows - 1, c1FlexGridClassic1.Cols -1,
    System.Drawing.Color.Red);

    //Set Backcolor for the first Column to blue
    c1FlexGridClassic1.set_Cell(CellPropertySettings.flexcpBackColor, 1, 1, c1FlexGridClassic1.Rows - 1, 1,
    Color.Blue);


    The Version of the Control I am unsing is C1.Win.C1FlexGrid.Classic.4.5.20202.438

  • Replied 17 November 2020, 8:10 pm EST

    My_Prj_BackColor.zip
  • Replied 18 November 2020, 6:14 pm EST

    Hi,

    When you call the set_cell for a cell range and the cells in that range do not have the same custom CellStyle associated with it, a new CellStyle is created and applied to it. So in your code when you call the set_cell at first a new CellStyle gets associated with all the cells. Now, when you call the set_cell again since the cells in the range have the cell style associated with them, this style gets modified and every cell that has this cell style which in your case is all cells reflects the same changes.
    Now, as we did in the previous sample, you can call set_cell for columns one by one so that cells of a column have the same cell style. Please find the modified sample attached.

    If you have any questions, please let me know.

    Regards,
    Prabhat Sharma.
    Prj_BackColor_New_Mod1.zip
Need extra support?

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

Learn More

Forum Channels