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.
Unfortunately, activation email could not send to your email. Please try again.

Center across selection alignment

Thread ID:

Created:

Updated:

Platform:

Replies:

43415 Apr 22,2006 03:19 AM Apr 24,2006 04:17 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On April 22, 2006 03:19 AM

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 04:17 AM

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

CONFIRMATION

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.

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.

;