Hi, i have a Ultragrid on my Windowsform. It has 5 Columns the Columns not fill the whole size of the Grid. Now i want center the Columns (is that possible) and when i resize the form (the Grid hat its Property Dock set to fill) i want to center the Columns/Content .Can you help me?
Hi,
martin2004 said:Now i want center the Columns (is that possible) and when i resize the form (the Grid hat its Property Dock set to fill) i want to center the Columns/Content
If you have a single-band grid, then you could center the grid content like this:
private void CenterGridContent(UltraGrid grid) { int gridWidth = grid.Width; UltraGridBand band = grid.DisplayLayout.Bands[0]; int bandWidth = band.GetExtent(BandOrigin.PreRowArea); int difference = gridWidth - bandWidth; band.Indentation = difference / 2; }
Call this method from Form_Load and also from the grid_Resize event. I tried it out and it seems to work very well for me.