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.
Syncfusion Feedback

Borders for a cell range

Thread ID:

Created:

Updated:

Platform:

Replies:

31772 Jul 14,2005 09:11 AM UTC Jul 14,2005 12:56 PM UTC Windows Forms 5
loading
Tags: GridControl
Franz Gsell
Asked On July 14, 2005 09:11 AM UTC

Concerning I have made a selection of some cells. Now I want to change the border for the whole selection (not for every cell in the selection but for the whole). Now I have the following code which doesn''t work: GridRangeInfoList aS = gridControl1.Model.SelectedRanges; GridRangeInfo rI = aS.ActiveRange; GridStyleInfo style = new GridStyleInfo(); style.Borders.All = new GridBorder(GridBorderStyle.Solid); gridControl1.ChangeCells(rI, style); So now i get every cell in my range selection with borders around. But i want a border around the whole selection - what can I do?

Administrator [Syncfusion]
Replied On July 14, 2005 09:32 AM UTC

First thing to check would be setting grid.ExcelLikeSelectionFrame = true to see if that gives you what you want. If not, you could divide the activerange up into 4 ranges, the top cells, the left cells, the bottom cells, and then the right cells. On these four ranges, you could use code like you have above to set the proper border on each range. So, on the left range, you would set Borders.Left instead of Borders.All, and do this for each of the four ranges. You could also look at the custom borders sample as that shows another way, you can handle custom borders. \Windows\Grid.Windows\Samples\In Depth\CustomBorders

Franz Gsell
Replied On July 14, 2005 11:10 AM UTC

So you mean I have to put the line: grid.ExcelLikeSelectionFrame = true on top of my code or do i have to select the rows in another way? >First thing to check would be setting grid.ExcelLikeSelectionFrame = true to see if that gives you what you want. > >If not, you could divide the activerange up into 4 ranges, the top cells, the left cells, the bottom cells, and then the right cells. On these four ranges, you could use code like you have above to set the proper border on each range. So, on the left range, you would set Borders.Left instead of Borders.All, and do this for each of the four ranges. > >You could also look at the custom borders sample as that shows another way, you can handle custom borders. \Windows\Grid.Windows\Samples\In Depth\CustomBorders

Administrator [Syncfusion]
Replied On July 14, 2005 12:09 PM UTC

You can set this property at design time or in form.load.
private void Form1_Load(object sender, System.EventArgs e)
{
	this.gridControl1.ExcelLikeSelectionFrame = true;
}
If you do this. the grid will draw a bold frame around the selection as your user selects a range of cells.

Franz Gsell
Replied On July 14, 2005 12:14 PM UTC

Ok, thank you very much, but this option doesn''t even take the effect i want. The border of the selected range is still set for every cell instead of the whole selected range (after setting the border for the range). So I think I have to implement your second suggestion to set the borders for every side seperately. Or is there another way? Kind regards Franz PS: The support is great - this makes a really good product :-))

Administrator [Syncfusion]
Replied On July 14, 2005 12:56 PM UTC

If you want to turn off the borders inside, then you would have to do it cell by cell. One way would be to loop through all the cells (not only the Left, Right, Top and Bottom), but also the interior cells and explicitly turn off the borders that you do not see. But another way would be to handle this dynamically using QueryCellInfo to provide the proper borders for each cell. You would also have to use SlectionsChanged to make sure the selected area is redrawn so the proper borders are seen. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GC_ExcelLikeSelectionFrame_e15b54f8.zip

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.

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

;