I have two columns in my wingrid, one with the name of the company and one with the logo of the company. At this moment the image is automatically sized to fit into the size of the row. I want this to be invers, i want the height of the row to adjust automatically to the height of the logo of the company. I use VS 2003 and NetAdvantage 2007/1. I use an EmbeddableImageRenderer to render the logo into the cell. Does anybody know how to get this done?
Have you tried calling PerformAutoResize on the column and the row? You might also have to set RowSizing to Free to get this to work.
If that doesn't work, then you would probably have to manually set the height of the row and the width of the column to the same size as the image. Are all of the logos the same size?
Mike,
Thank you for your speedy reply.
Your suggestion did already solve one problem, the user is now able to resize the row manually by double clicking on the bottom edge of each row. To answer your question: the images can be of different size and futhermore there may be more than one column containing an image and the row has to resize to the biggest picture. The double click function does this exactly as it should, so i guess now i need a way to tell each row to perform the same action as the doubleclick.
The 'PerformAutoResize' method does not exist on the row, i did find a 'PerformAutoSize' method so i suppose that's the method you mean, anyway that did not work.
As i explained i work with a EmbeddableImageRenderer object to set the image in the cell. Is there any way i could retrieve image size from that object?
If not, is there a way simulate the double click on the edge of the row?
Also i notticed that if you use double click on the edge of the row and then double click on the right edge of the colum, the column is resized in the width, but the resizing of the row in the height is then reset, anyway to avoid that?
Best Regards
Peter
Hi Peter,
Yes, the PerformAutoSize method of the row is what I was referring to. This method should programmatically simulate what happens when the user double-clicks on the bottom edge of the row. If this is not working, then something is wrong. Are you sure you are calling this method in the right place? Has the image been set on the row first? Iw ould use InitializeRow for this.
besixict said:Also i notticed that if you use double click on the edge of the row and then double click on the right edge of the colum, the column is resized in the width, but the resizing of the row in the height is then reset, anyway to avoid that?
That sounds like a bug to me. Resizing the column should not resize the row.
Hi,
I have found a solution that is good enough to serve my purpose:
I have set
And in the initializerow event i have called a PerformAutoResize() on the columns with an image.
In the end this works best if the images are not to large.
Still i think this is a lot of things to change to become a solution. I think that what's missing in the grid is a ColumnSizing property that can be set to 'AutoFree' as well. The UltraGrid is a powerfull piece of software. With this power inherrently comes complexity.
Thanks for your help
PS: About that 'double clicking bug', apparently this has something to do with my RowSizing Property being set to 'Free' at the time. Setting that property to 'AutoFree' solved that problem. But i agree this could be a bug.