Rectangle of a Column Caption

Posted by: kmeads on 17 October 2022, 7:11 am EST

  • Posted 17 October 2022, 7:11 am EST

    I’m trying to get the Rectangle of a given column caption. Currently, I’m using the GetCellBounds method from the Split class and that mostly works. The call looks like this:

    Rectangle l_colRect = MyGrid.Splits[l_splitIdx].GetCellBounds(0, l_colIdx);

    From there, I recalculate the Y coordinate based on caption heights, etc. However, this makes it depend on there being data present. If there isn’t, an exception gets thrown because there is no row 0.

    I suppose I could calculate the X coordinate and the width of the desired rectangle based on cycling through the DisplayColumns in the split and adding the widths and also taking into account the horizontal scrollbar offset. But, isn’t there already a method that would allow me to get it without depending on data being in the grid?

  • Posted 17 October 2022, 6:31 pm EST

    Hi,

    We have escalated the query to the development team to get their insights on this. We will let you know as soon as we have an update.

    Regards

    Avnish

    [Internal Tracking ID: C1WIN-28412]

  • Posted 17 October 2022, 9:53 pm EST

    Hi,

    As per the development team, currently, as a workaround, you can use the Accessibility API to get the header bounds. Please refer to the attached sample.

    We have also posted a feature request for this and will let you know when we have any updates.

    Regards

    Avnish

    [Internal Tracking : C1WIN-28414]

    WindowsFormsApp1.zip

  • Posted 18 October 2022, 4:45 am EST

    Thank you! I would love to see that method added in. Thank you for the time taken to look into it.

  • Posted 25 April 2023, 8:41 pm EST

    Hi,

    The GetHeaderCellBounds() method for a split of C1TrueDbGrid has been added. Please update to the latest release and let us know if you face any issues.

    Regards

  • Posted 27 April 2023, 4:48 pm EST

    Thank you very much! I appreciate you very much for listening and adding in a method for that! We will be grabbing the latest code sometime in the next few months and I will give it a try at that point.

    Thank you again!

Need extra support?

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

Learn More

Forum Channels