flexcpFontBold doesn't work corretly while use flexcpBackColor in same Row

Posted by: samo3889 on 28 January 2018, 1:11 am EST

    • Post Options:
    • Link

    Posted 28 January 2018, 1:11 am EST

    Hi all

    i use C1FlexGridClassic (Version:4.0.20172.271)

    when i use flexcpFontBold and flexcpBackColor together the flexcpFontBold doesn’t work correctly.

    i want to make first column in specific row in Bold and after that i want to paint all row but it make all row in Bold

    look at the following exmaple: flexcpFontBold.zip

    thanks.

    saleem :slight_smile:

    flexcpFontBold.zip

  • Posted 28 January 2018, 6:32 pm EST

    Hello Saleem,

    Thank you for sharing the sample file.

    We were able to reproduce this issue and it seems to be a bug. Hence we have forwarded it to the concerned team for fix {Tracking ID: 306183}. We will update you once it is fixed.

    Thanks,

    Ruchir Agarwal

  • Posted 28 January 2018, 7:37 pm EST

    ok thanks Ruchir

    i also wait for response related to this link :

    https://www.grapecity.com/en/forums/winforms-edition/c1combobox---c1comboboxsel

  • Posted 11 February 2018, 9:16 pm EST

    Hi Saleem!

    1. The issue : “flexcpFontBold doesn’t work corretly while use flexcpBackColor in same Row” is with the development team only. We’ll update you once there is any information from them.

    2. For the issue : “C1ComboBox - c1ComboBox.SelectedIndexChanged call event 2 times” on the link that you have mentioned on this thread, please check the same link. For any further query on that, I would request you to post over there only.

    Thanks,

    Meenakshi

  • Posted 14 February 2018, 2:52 am EST

    i solve it by extensions overwrite

    the problem is when change style backcolor then copy all styles to other cells

    i write extension to solve it

    private static void set_CellflexcpBackColor(this C1.Win.C1FlexGrid.Classic.C1FlexGridClassic grid, int row1, int col1, int row2, int col2, object newVal)

    {

    var boldCellList = new List();

            //Color all cells that doesn't have a bold style
            for (var row = row1; row <= row2; row++)
            {
                for (var col = col1; col <= col2; col++)
                {
                    if (Convert.ToBoolean(grid.get_Cell(CellPropertySettings.flexcpFontBold, row, col)))
                    {
                        //Add Cell to boldCellList to color after iternations
                        boldCellList.Add(new Tuple<int, int>(row, col));
                    }
                    else
                    {
                        grid.set_Cell(CellPropertySettings.flexcpBackColor, row, col, row, col, newVal);
                    }
    
                }
            }
            //Color all cells that have a bold style
            foreach (Tuple<int, int> item in boldCellList)
            {
                grid.set_Cell(CellPropertySettings.flexcpBackColor, item.Item1, item.Item2, item.Item1, item.Item2, newVal);
            }
        }
    

    thanks!!!

    saleem.

  • Posted 25 February 2018, 3:08 pm EST

    Hello Saleem,

    We found one more workaround to the issue: We can use C1FlexGridBase.Styles collection in combination with C1FlexGridBase.GetCellRange method and C1FlexGridBase.SetCellStyle method, as follows:

    ```

    var grayRowStyle = c1FlexGridClassic1.Styles.Add(“GrayRowStyle”);

    grayRowStyle.BackColor = Color.Gray;

    var firstRowRange = c1FlexGridClassic1.GetCellRange(1, 1, 1, c1FlexGridClassic1.Cols - 1);

    firstRowRange.Style = grayRowStyle;

    var boldCellGrayRowStyle = c1FlexGridClassic1.Styles.Add(“BoldCellGrayRowStyle”, grayRowStyle);

    boldCellGrayRowStyle.Font = new Font(boldCellGrayRowStyle.Font, FontStyle.Bold);

    c1FlexGridClassic1.SetCellStyle(1, 1, boldCellGrayRowStyle);

    Also, I have attached a sample application implementing this approach and giving desired output at our end.
    
    Regards,
    Ruchir Agarwal
    [zip filename="WindowsFormsApplication8_modified.zip"]public\uploads\8a08f7271f997f6c86f8db0259e15eb81519618013653.zip[/zip]
Need extra support?

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

Learn More

Forum Channels