Removing current cell selection border

Hello,

In order to achieve an Excel like effect we'd like to turn off the border around the current cell whenever there is a wider selection. I've attached pictures of what I am talking about.

Thanks,
Ben

selection.zip

1 Reply

AJ Ajish Syncfusion Team September 3, 2007 11:23 PM UTC

Hi Ben,

To remove current cell selection border you need to handle ShowCurrentCellBorder property and switch it accordingly in the selection changing event.

>>>>>>>
this.gridControl1.SelectionChanging += new Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventHandler(gridControl1_SelectionChanging);

void gridControl1_SelectionChanging(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs e)
{
GridCurrentCell cc = gridControl1.CurrentCell;
int height = gridControl1.Selections.Ranges.ActiveRange.Height;
int width = gridControl1.Selections.Ranges.ActiveRange.Width;
if (gridControl1.Selections.Ranges.AnyRangeIntersects(cc.RangeInfo) && (height > 1 || width > 1))
{
this.gridControl1.Model.Options.ShowCurrentCellBorderBehavior = Syncfusion.Windows.Forms.Grid.GridShowCurrentCellBorder.HideAlways;
}
else
{
this.gridControl1.Model.Options.ShowCurrentCellBorderBehavior = Syncfusion.Windows.Forms.Grid.GridShowCurrentCellBorder.AlwaysVisible;
}
}
>>>>>>>

Here is the link for the sample:
http://websamples.syncfusion.com/samples/Grid.Windows/F67867/main.htm

Kindly take a look and let me know if you need any further assistance.

Regards,
Ajish

Loader.
Up arrow icon