I have an UltraWinGrid bound to a DataTable. There is an unbound column as well. When I click a button in my app, I add a row to this DataTable, and set the following 2 properties for the unbound column: gridRow.Cells["DELETE"].Appearance.Image = Properties.Resources.About16; gridRow.Cells["DELETE"].Appearance.ImageHAlign = HAlign.Center;
Then I call this: grid.DisplayLayout.Bands[0].Columns["DELETE"].PerformAutoResize(PerformAutoSizeType.VisibleRows);
I am attaching a screenshots for BEFORE and AFTER. I would like the column to resize to fit the size of the image, no more, no less. However, as you can see from the BEFORE that doesn't happen right away. If I click the button again to add another row, then it resizes properly (see AFTER). Is this a timing issue? If so, what event should I put the resize call in?
Thanks in advance!
The problem is that you are passing in PerformAutoSizeType.VisibleRows. The row is not visible, yet, because the grid has not painted.
Try passing in AllRowsInBand.
Or, try calling Refresh on the grid to force a paint before you call PerformAutoResize.
Hi Mike,
I'm trying to do similar thing, showing bitmap image (JPEG) in the the grid cell. But there's nothing in that cell where the image should be.
I'm using UltraWinGrid v10.3.
here is my code which resides in BeforeRowExpanded event:
ugSocialMediaContent.DisplayLayout.Bands(1).Columns("Image").Style = UltraWinGrid.ColumnStyle.Image Dim bitmapAvatar As Bitmap = New Bitmap(awebclient.OpenRead(ugSocialMediaContent.ActiveRow.Cells("ImageURL").Text)) ugSocialMediaContent.ActiveRow.Cells("Image").Appearance.Image = bitmapAvatar ugSocialMediaContent.Refresh() ugSocialMediaContent.DisplayLayout.Bands(1).Columns("Image").PerformAutoResize(PerformAutoSizeType.AllRowsInBand)
Please let me know what I'm doing wrong.
Thanks.
Yep that did it. Thanks again Mike!