Unable to center image in GridControl cell

I''m trying to center a .bmp image in a cell in a GridControl grid. Know there been several posts about this, but I''m not able to get it working right, the image is always left-aligned in the cell. I''m using version 3.2.1.0. This is my code: theGrid[i+1,1].CellType = "Static"; theGrid[i+1,1].ImageList = ((MainForm)TopLevelControl).MiscImages; theGrid[i+1,1].ImageIndex = 0; theGrid[i+1,1].HorizontalAlignment = GridHorizontalAlignment.Right; theGrid[i+1,1].ImageSizeMode = GridImageSizeMode.CenterImage;

3 Replies

AD Administrator Syncfusion Team September 2, 2005 10:26 AM UTC

By default, setting the CellType to Image aligns the Image to the center. For setting the Horizontal alignment of the Image, you need to set the GridImageSizeMode to either Normal / AutoSize. GridStyleInfo style ; style = this.gridControl1[1,3]; style.CellType = "Image"; style.ImageList = imageList1; style.ImageIndex = 2; style.ImageSizeMode=GridImageSizeMode.Normal; style.HorizontalAlignment=GridHorizontalAlignment.Center;


GA Geir Aamodt September 2, 2005 12:28 PM UTC

Ah, thanks Jeba for quick and accurate solution!


AD Administrator Syncfusion Team September 2, 2005 02:05 PM UTC

Hi Geir, Thank you for your update. We appreciate your interest in Syncfusion Prodcuts. Best Regards, Jeba

Loader.
Up arrow icon