Placement of GridLines around a cell

Posted by: j2associates on 8 September 2017, 12:28 pm EST

  • Posted 8 September 2017, 12:28 pm EST

    Hello,


    In certain situations, I need to overlay the FarPoint cell with a Windows Forms ComboBox because FarPoint does not yet support a Bound ComboBox CellType. I want to just fit it exactly inside the given FarPoint cell and plan to use GetCellRectangle to get the rectangle for my ComboBox.


    Do gridlines surround a cell like this where dot = GridLine and so point 0, 0 is just to the left of and down from the first GridLine (eg where the upper left + sign is) 

    A.  ...................................
    .+-------------------------------+.
    .| |.
    .| |.
    .| |.
    .| |.
    .| |.
    .| |.
    .| |.
    .+-------------------------------+.
    ...................................

    or are they inside the cell like this and point 0,0 overwritew the GridLine

    B. +--------------------------------+
    |................................|
    |. .|
    |. .|
    |. .|
    |. .|
    |. .|
    |. .|
    |. .|
    |................................|
    +--------------------------------+

    or are they actually on the cell border like this

    C. ...................................
    . .
    . .
    . .
    . .
    . .
    . .
    . .
    . .
    . .
    ...................................
    If they surround the cell similarly to A above, then GetCellRectangle should
    work right out of the box for what I need it to do. In the case of B or C,
    how do I determine the actual Gridline width and/or height so that I can
    properly adjust my rectangle coordinates. Do I need to concern myself with
    Horizontal GridLines and Vertical GridLines as different properties?
    Thanks in advance for any ideas and/or suggestions.

  • Replied 8 September 2017, 12:28 pm EST

    Hello,



    When you get the size of a cell the grid lines are not taken into account. Are you attempting to overlay a control on top of the Spread control?



    Have you considered creating a custom celltype and using the PaintCell method to display your control? You can get the rectangle you need from there to render your control properly.
  • Replied 8 September 2017, 12:28 pm EST

    Hello Robt,


    I have a Windows Forms ComboBox that is bound to a data source to populate its list. There are too many to spin through and populate a ComboBoxCellType so when the user clicks in the spread cell, I get the spread rectangle and resize and reposition my Windows Forms ComboBox so that it looks like it is contained within the spread cell just like a normal ComboBoxCellType. Then in the leave event I hide my Windows Form ComboBox and set the spread cell value to the appropriate Windows Forms ComboBox value.


    I want to simulate as closely as possible a ComboBoxCellType so that my Windows Forms ComboBox is contained within the grid lines. So my question is do I need to offset the Rectangle I get from the spread methods to account for the gridlines (eg x + 1, y + 1, height - 2 and width - 2). Thanks again for taking time to respond!

  • Replied 8 September 2017, 12:28 pm EST

    j2 -

    I don't know what your application timeline is, but we have a bindable combobox in our version 3, which is now in beta.
  • Replied 8 September 2017, 12:28 pm EST

    Hello Bob,


    I know about it but I can't wait on it although I am looking forward to implementing it as quickly as possible once it is released. Thanks!

  • Replied 8 September 2017, 12:28 pm EST

    Hello,


    The GetCellRectangle method should return the full width of the cell, including the borders and gridlines, so you are going to have to resize the size of the rectangle to paint your combobox into or you will overwrite the text in the cells around the cell being sized.

Need extra support?

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

Learn More

Forum Channels