Skip to content

SyncfusionExamples/How-to-center-align-the-background-image-in-a-cell-in-WinForms-GridControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

How to center align the background image in a cell in WinForms GridControl?

In WinForms GridControl, a background image can be applied to a specific cell. To align the background image to the center, set the BackgroundImageMode property to CenterImage. This helps ensure the image is properly centered within the cell.

private void OnAddImage(object sender, EventArgs e)
{
    var img = Image.FromFile(@"..\..\Images\img.png");
    this.gridControl1[2, 2].CellType = "Image";
    this.gridControl1[2, 2].BackgroundImage = img;
    this.gridControl1[2, 2].BackgroundImageMode = GridBackgroundImageMode.CenterImage;
}

Center align background image

Take a moment to peruse the WinForms GridControl - BackgroundImage documentation, where you can find about background image with code examples.

About

This demo shows how to center align the background image in a cell in WinForms GridControl

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages