Skip to content

About

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

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

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

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages