You can use foreground images to add visual cues to static list elements such as caption bars, column headers, and column footers. Foreground images are specified by the ForegroundImage property of the Style class. These images can be displayed beside some text or in place of it, but can not be displayed over text.
Use the following steps to add image to the List control. In the following example, we have subscribed to the FetchCellStyle event to display images in cells.
C# |
Copy Code
|
---|---|
// Fire the FecthCellStyle event. this.c1List1.Splits[0].DisplayColumns[1].FetchStyle = true; this.c1List1.FetchCellStyle += C1List1_FetchCellStyle; |
C# |
Copy Code
|
---|---|
private void C1List1_FetchCellStyle(object sender, C1.Win.C1List.FetchCellStyleEventArgs e) { if (e.Col == 1) { e.CellStyle.ForeGroundPicturePosition = C1.Win.C1List.ForeGroundPicturePositionEnum.PictureOnly; e.CellStyle.ForegroundImage = Image.FromFile("../../Image.bmp"); } } |