Alignment DatagridView - DataGridViewContentAlignment.MiddleCenter

1
0

I Want align in middlecenter a icon. But how i do that?
The status Column is a imageColunm, and a put this code inside the cellformating.

I tried:

this.MsgDataGridView.Columns[“Status”].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//this way is not working.

and,

e.CellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter //this way is not working.

how i can do?

 

  • You must to post comments
0
0

Hi Jay,

You’ll probably want to use the CellStyle.BackgroundImageAlign property.

Try this line:
e.CellStyle.BackgroundImageAlign = ContentAlignment.MiddleCenter;

It should work fine!

HTH,
Alaa

//

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.