Hello
I would like to set a cell picture to the first column with the following conditions:
1) The picture is chosen according to the value of the third cell.2) It is left aligned within the cell.3) The cell's text has to be aligned to the right of the picture (no overlapping).
Thanks a lot
You probably want to use Image rather than ImageBackground if you want the image to be next to the cell.
The code here will also apply the same image to every cell in the column. If you want a different image in each cell, you would use the InitializeRow event and set e.Row.Cells("column key").Appearance.Image
Perhaps using the CellAppearance.ImageBackground Property:
Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, _ ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) _ Handles UltraGrid1.InitializeLayout Me.UltraGrid1.DisplayLayout.Bands(0).Columns(0).CellAppearance.ImageBackground = _ Me.ImageList1.Images(0) End Sub
Private Sub
ByVal
As Object
As
Handles
Me
End Sub
In C#:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellAppearance.ImageBackground = this.imageList1.Images[0]; }
private void
object
this
I have a similar requirement to have an image right beside a number in a cell, but my question is a bit more basic.
How do you get an image and text into a single cell?
Thanks,
Steve
1) Use the InitializeRow event and examine the value of cell 3 and set the Appearance.Image property of cell 1.
2) Set the Appearance.ImageHAlign on the cell to left.
3) #2 should take care of this, but you could also set TextHAlign to right.