Location and Width of a split in a C1TrueDBGrid

Posted by: kmeads on 2 April 2021, 3:46 am EST

    • Post Options:
    • Link

    Posted 2 April 2021, 3:46 am EST

    I am trying to get the width and location, in pixels, of a split in a C1TrueDBGrid. I cannot seem to find it! While debugging, I can inspect the Split and I do see ClientRect which has all of the information that I need, but as it turns out, that is a protected member for some reason so I cannot access it. I’ve been through the documentation for the control but I cannot find anything that directly provides that information. Am I missing something?

  • Posted 4 April 2021, 6:10 pm EST

    Hi,

    The actual size of the split at run-time depends on its SplitSize and SplitSizeMode properties. The SplitSizeMode property specifies the unit of measurement; the SplitSize property specifies the number of units. You can use these properties of the splits to calculate the width of a split accordingly. Since ClientRect has all information that you need and you only need to get the width and location, you can use reflection to get the value of the ClientRect property of the Split. Please refer to the sample attached.

    Regards.

    Avnish

    TDBSplitLocaion.zip

  • Posted 18 April 2021, 5:18 pm EST

    Thank you so much! This is exactly what I needed. I do have a follow-up question, however. You say that the SplitSizeMode property and SplitSize can be used to calculate the width of a split. If the SplitSizeMode is “Scalable” - SplitSize always returns back a “1”. In fact, that was part of my original issue - I couldn’t see how to calculate the exact size of the split if they are “Scalable”. The user can drag the split bar one way or the other and the SplitSize will still be a “1”.

    Thanks for the original answer, btw - that really did accomplish what I was looking to do.

  • Posted 19 April 2021, 10:45 pm EST

    Hi,

    When the SplitSizeMode is Scalable, the splits resize relative to other splits. So all splits having SplitSize = 1 means that all splits will be equal size, if you set the SplitSize = 2 then the split and the splits in that column will have double the width of the other splits. So what I meant by calculating is you will have to take the behavior of the SplitSizeModes and the value of SplitSize in account and then calculate the size of split according to the size of TrueDbgrid. For more info visit: https://www.grapecity.com/componentone/docs/win/online-truedbgrid/sizingandscalingspli.html.

    Regards.

    Avnish

Need extra support?

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

Learn More

Forum Channels