# Setting a Background Image to a Cell

Learn how to customize the background of a cell by adding a graphic image in this comprehensive guide.

## Content

You can customize the background of a cell by adding a graphic image.
![Cell with Background Image](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/cell-backimage.png)
For more information on image cell types, refer to [Setting an Image Cell](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-setcelltypes/spwin-setgraphcelltypes/spwin-setimagecell).
For more information on setting an image for all the cells in a sheet (as part of the default style) refer to [Setting a Background Image for a Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-setappearance/spwin-appearsheet/spwin-sheetbackimage).

## Example

The following example adds an image to a text cell.

```csharp
private void Form1_Load(object sender, System.EventArgs e)
{
// Create an instance of a text cell.
FarPoint.Win.Spread.CellType.TextCellType t = new FarPoint.Win.Spread.CellType.TextCellType();
// Load an image file and set it to BackgroundImage property.
FarPoint.Win.Picture p = new FarPoint.Win.Picture(Image.FromFile("D:\\images\\lionstatue.jpg"), FarPoint.Win.RenderStyle.Stretch);
t.BackgroundImage = p;
// Apply the text cell.
fpSpread1.ActiveSheet.Cells[1, 1].CellType = t;
// Set the size of the cell so the image is displayed
fpSpread1.ActiveSheet.Rows[1].Height = 50;
fpSpread1.ActiveSheet.Columns[1].Width = 150;
}
```

```vbnet
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
   ' Create an instance of a text cell.
   Dim t As New FarPoint.Win.Spread.CellType.TextCellType
   ' Load an image file and set it to BackgroundImage property.
   Dim p As New FarPoint.Win.Picture(Image.FromFile("D:\\images\\lionstatue.jpg"), FarPoint.Win.RenderStyle.Stretch)
   t.BackgroundImage = p
   ' Apply the text cell.
   fpSpread1.ActiveSheet.Cells(1, 1).CellType = t
   ' Set the size of the cell so the image is displayed
   fpSpread1.ActiveSheet.Rows(1).Height = 50
   fpSpread1.ActiveSheet.Columns(1).Width = 150
End Sub
```

## See Also

[Setting the Background Colors for a Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-setappearance/spwin-appearsheet/spwin-sheetbackcolor)
[Coloring a Cell](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-setappearance/spwin-appearsheet/spwin-cellcolor)
[Setting a Background Image for a Sheet](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-setappearance/spwin-appearsheet/spwin-sheetbackimage)