I have a button column that displays an image in the button. The image is very small, so the button could be fairly narrow, but it defaults to a much larger size. This looks bad and wastes space. How can I either:
1. Make the grid automatically size the column to the minimum width needed to show the image on the button?
2. Manually resize the column to the minimum width needed (the problem here is determining what that width should be, given an image width.)?
Have you tried calling PerformAutoResize on the column? If so, be sure to use the overload that takes an enum and specify AllRowsInBand.
If that doesn't work, what's the DataType of the column? Does this column have any data in it?
No I hadn't tried PerformAutoResize(). Didn't know it existed.
I tried and it resized it from 100 to 8, which is far too small.
This is a button column I added so there is no data associated with it (right?)
To create the column I went to the column collection and called Add() with a unique column name. Then I iniitalized it like
DelCol.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button; DelCol.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; DelCol.Hidden = false; DelCol.Header.VisiblePosition = 0; DelCol.Header.Caption = ""; DelCol.CellButtonAppearance.Image = DelImg;