Ticket Q135099
Visible to All Users

Changing row height at runtime

created 16 years ago

Hi
Changing row height CalcRowHeight event handler of banded grid view at runtime seems to give unexpected result.
In banded gridview I want to increase the height of a row when user clicks within a rectangle area within that row. After making sure that the rectangle in question is clicked I call bandedGridView1.LayoutChanged() method on the banded gridview to fire the CalcRowHeight event of the banded gridview. Then I use following code in that event's event handler:
        private void bandedGridView1_CalcRowHeight(object sender, RowHeightEventArgs e)
        {
            // check if the mouse click was within the 'sensitive' rectangle
            if (isWithinBounds && rowToBeUpdated == e.RowHandle)
            {
                //change row height
                e.RowHeight += 20;
                // reset private variables
                isWithinBounds = false;
                rowToBeUpdated = -1;

}
        }
When the app is run and the rectangle is clicked, the row height changes in the way shown in the attached JPG. The gap between the clicked row and the next one increases but the row itself doesn't seem to expand. It looks like the row height can be set when the grid is loading, but on runtime, it behaves different when row height is changed.
Can you guide me what to do to make the row itself to expand?
Regards
Okash

Show previous comments (2)
DevExpress Support Team 16 years ago

    Hi Okash,
    You shouldn't modify any other variable from within the CalcRowHeight event handler. This event can be fired multiple times during various grid calculations.
    We recommend that you change the row height condition on every mouse click. Moreover, to determine if a point belongs to a cell rectangle, calculate the GridHitInfo object.
    I have modified your project accordingly. It is attached. Please let us know if this makes sense.
    Thanks,
    Michael.

      Hi Michael
      Thanks for the updates project. That solves the problem!
      Best regards
      Okash

      DevExpress Support Team 16 years ago

        Hi Okash,
        I am happy to hear that my assistance was helpful to you. Please do not hesitate to contact us if you experience problems when using our products. We will be happy to help you at any time.
        Thanks,
        Michael.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.