Like in a TreeNodeAdv object, I would like to have a grid cell displaying normal text and various images (example:2 at the left and 1 at the right - showing various status).
The only thing I have seen is that I can put a text and a left image like this:
mygrid[1,1].CellValue = "My Text";
mygrid[1,1].ImageList = myImageList;
mygrid[1,1].ImageIndex = 0;
Is it possible with the GridControl to have cells with more images (left & right)?
ADAdministrator Syncfusion Team July 23, 2004 03:05 AM
There are several sandard ways to include pictures in a cell including the one you mentioned. But they all work with a single picture.
But it is straight forward task to include as many pictures as you like in a cell, and to position them anyway you want them. You can do this either using a grid.CellDrawn event or deriving a custom celltype that is ''many-picture-aware''.
Here is code that puts 3 pictures, one to the left and two to the right using the grid CellDrawn event. This code expects you to reserve the space for the picture by setting the style.TextMargins and to specify the 3 pictures by setting them in order in the style.ImageList property. (The same kind of thing can be used in a custom cell control.)
//get the images somehow....
ImageList images = new ImageList();
GridStyleInfo style = this.gridControl1[2,2];
style.Text = "Some Text";
style.ImageList = images; //3 images
int pictureWidth = images.ImageSize.Width + 2;
style.TextMargins.Left = pictureWidth; //1 on left
style.TextMargins.Right = 2 * pictureWidth; //2 on right
this.gridControl1.ColWidths = 3 * pictureWidth + 65; //65 is the text width part
this.gridControl1.CellDrawn += new GridDrawCellEventHandler(grid_DrawCell);