We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Center across selection alignment

Thread ID:





43415 Apr 22,2006 07:19 AM UTC Apr 24,2006 08:17 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On April 22, 2006 07:19 AM UTC

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.

Administrator [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon