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.

Formatting multiple - selected cells

Thread ID:

Created:

Updated:

Platform:

Replies:

61868 Jun 4,2007 08:11 AM Jun 4,2007 01:18 PM Windows Forms 1
loading
Tags: GridControl
Vivek Vashisht
Asked On June 4, 2007 08:11 AM

I am using a Grid Control and have set the property
this.gridControl1.AllowSelection = GridSelectionFlags.Any;

I am able to select multiple cells using the ctrl key but when I try to format all the selected cells, it is applied only to the last selected cell
Can you please tell how to implement a format change to all the selected cells..

thanks
Vivek

haneefm [Syncfusion]
Replied On June 4, 2007 01:18 PM

Hi Vivek,

You can hanlde the PrepareViewStyleInfo event to format the selected cells in a grid. Here is a code snippet that show this task:

private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridControl grid = sender as GridControl;
if( grid.Model.Selections.Ranges.AnyRangeIntersects(GridRangeInfo.Cell(e.RowIndex,e.ColIndex))
|| ( grid.CurrentCell.RowIndex == e.RowIndex && grid.CurrentCell.ColIndex == e.ColIndex ) )
e.Style.TextColor = Color.YellowGreen;
}

Best 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.

;