C1FlexGrid cannot replace checkbox image in fixed column

Posted by: dung.itcdt on 17 August 2023, 9:53 pm EST

  • Posted 17 August 2023, 9:53 pm EST - Updated 17 August 2023, 9:58 pm EST

    Hi,

    I am using the latest c1flexgrid version (2023v2) and setting DataType=boolean for the fixed column.

    I use the OwnerDrawCell event to replace the default checkbox image but it doesn’t work.

    Can you help me?

  • Posted 20 August 2023, 4:26 pm EST

    Hi,

    To replace the default checkbox icons with your custom icons, you do not need to use the OwnerDrawCell event. You can just replace the default icons with your custom icons using the C1FlexGrid.Glyphs property.

    Please see the attached sample project for reference FlexGrid.FixedCheckBox.zip

    Best Regards,

    Kartik

  • Posted 20 August 2023, 5:17 pm EST - Updated 20 August 2023, 5:17 pm EST

    Hi Kartik,

    Thank you for your reply,

    I mean still use the default checkbox but it will show conditionally.

    Thanks & Best Regards

  • Posted 20 August 2023, 10:12 pm EST

    Hi,

    As per our understanding, you want to show checkboxes in the fixed column, but only for specific rows based on your condition. For this, instead of setting the column’s DataType to boolean, you can use the C1FlexGrid.SetCellCheck method. To get the checkbox value from the cell, you can use the C1FlexGrid.GetCellCheck method.

    Please see the updated sample project for reference. FlexGrid.FixedCheckBox.Updated.zip

    Best Regards,

    Kartik

  • Posted 21 August 2023, 1:00 pm EST - Updated 21 August 2023, 1:06 pm EST

    Dear Kartik,

    Thanks for your sample project. But that’s not what I want.

    For example, I have any table of data, I want all rows with data ‘Red’ to be checked. So I want to use the OwnerDrawCell event to control the checkbox image. In the old version, I can use by assigning Glyphs[GlyphEnum.Checked] to e.Image. But in this new version, it is not possible.

    And I discovered another small error that the checkbox image is zoomed according to the font size, you can see the example image below:



  • Posted 21 August 2023, 5:26 pm EST

    Hi,

    As per our understanding, you only want to show the checked image in the fixed column (for rows with specific data). For this, you can use the OwnerDrawCell event to validate your condition and set the image accordingly. Please see the updated project for reference (FlexGrid.FixedCheckBox.CheckImage.zip).

    FYI, the default checkbox in the C1FlexGrid is scaled with the Font size for uniformity between the text and checkbox. This is the designed behavior of the C1FlexGrid. However, if you directly assign the checkbox glyph as the image of the cell, it won’t be scaled with the Font size.

    If you still face any issues, please update the attached project with your implementation and share it with us, so we can investigate further and assist you in the best way possible.

    Best Regards,

    Kartik

  • Posted 18 March 2024, 2:37 pm EST - Updated 18 March 2024, 2:37 pm EST

    Hi Kartik,

    I’ve been trying to set e.Image = but it seems that for columns with DataType=bool, the default checkbox is always drawn regardless of e.Image.

    How can I disable or override the default checkbox?

  • Posted 18 March 2024, 6:59 pm EST

    Hi,

    To hide the default checkbox for some cells of a column with DataType=bool, you can handle the OnwerDrawCell event and skip the content drawing of those cells (draw only the border and background). Please see the updated sample project for reference.

    Attachment: FlexGrid.FixedCheckBox.OwnerDraw.zip

    Best Regards,

    Kartik

  • Posted 19 March 2024, 1:10 pm EST

    Hello,

    I tried to intervene in the OwnerDrawCell events to assign an image to the cell, but the default checkbox image of the grid is always displayed.

    I am using version 4.8.2023.631.

    Below is the program I have edited. Please help me take a look.

    Thank you.

  • Posted 19 March 2024, 1:11 pm EST

    Hello,

    I tried to intervene in the OwnerDrawCell events to assign an image to the cell, but the default checkbox image of the grid is always displayed.

    I am using version 4.8.2023.631.

    Below is the program I have edited. Please help me take a look.

    Thank you.

    FlexGrid.FixedCheckBox.OwnerDraw.zip

  • Posted 19 March 2024, 3:07 pm EST

    Hi,

    To hide the default image of checkbox columns and use a custom image, you can use a text-type format for the CheckBox column and set the e.Text = string.Empty in the OwnerDrawCell event. Please see the updated sample project for reference - FlexGrid.FixedCheckBox.CustomImage.zip

    If you still face any issues, we request you clearly share your requirements in pointers, so we can create an implementation in that way, as your requirements are currently unclear.

    Thanks, and Best Regards,

    Kartik

Need extra support?

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

Learn More

Forum Channels