Center across selection alignment

I need to implement a horizontal alignment similar to excel''s "center across selection" alignment. I know the grid only provides near, center, and far horizontal alignments by default. Is there a way, through code, to replicate this alignment as in excel? Thanks.

1 Reply

AD Administrator Syncfusion Team April 24, 2006 08:17 AM UTC

Hi Alex, Please try this code to center the text across the group of cells.Here is a code snippet. //Form''s Load Event this.contextMenu1.MenuItems.Add("Center cross Aignment"); this.contextMenu1.MenuItems[0].Click +=new EventHandler(menu1_Click); private void menu1_Click(object sender, EventArgs e) { foreach(GridRangeInfo range in this.gridControl1.Model.SelectedRanges) { this.gridControl1.CoveredRanges.Add(range); this.gridControl1.Model[range.Top,range.Left].HorizontalAlignment = GridHorizontalAlignment.Center; } } Here is a sample. http://www.syncfusion.com/Support/user/uploads/centerAcrossSelection_faa923ef.zip Please let me know if you need any further assistance. Regards, Haneef

Loader.
Up arrow icon