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. Image for the cookie policy date
close icon

Cell Borders

Is it possible to override the drawing of cell borders?

8 Replies

AD Administrator Syncfusion Team February 6, 2004 09:54 PM UTC

You can turn off the cell borders by setting: style.Borders.All = new GridBorder(GridBorderStyle.None); Then you can handle the CellDrawn event and draw the borders there.

ST Steve February 7, 2004 11:11 AM UTC

Can you also override the drawing of the cell borders that appear during drag-n-drop operations?

ST Steve February 7, 2004 11:17 AM UTC

Another instance of overriding the cell border that I''m interested in occurs when you focus leaves the grid and there is a "rubber-band" like outline on the cell.

AD Administrator Syncfusion Team February 8, 2004 12:05 PM UTC

Normally, visual ques for a drag & drop operations are done on top of the grid, and not really done ''to the grid''. That said, I think you can do it by handling all the D&D work yourself. If would take some effort. Here is minimal try (a very rough sample) at it that would have to be tested and special cases handled. It derives a gridcontrol and exposes 2 events that let you control where/when the d&d cursor appears, and allows you to draw the visual feedback for the drag. Both the default behavior and the sample event handlers draw on top of the grid. But instead of drawing on top of the grid, you might try setting style properties to the cells at this point (and then unsetting them when they are no longer needed). But usually drawing your own visual ques is what is done. simple_Drag_1_3814.zip

ST Steve February 11, 2004 07:13 PM UTC

Thanks Clay. Is there a method I can override or an event i can cach to draw the cell borders around the current cursor? Perhaps an override to some type of drawcursor method? Thanks.

AD Administrator Syncfusion Team February 11, 2004 07:50 PM UTC

There is a DrawCurrentCellBorder event you could try. Or, you can use the CellDrawn event, and if it is the currentcell, draw what you want over top of default drawing.

ST Steve February 12, 2004 01:53 AM UTC

OK, i''m catching the DrawCurrentCellBorder event and drawing and manually drawing a cursor that paints over two cells. It works well, if I tab to another application and then back, but just scrolling arounds is having some refresh issues on the extra cell that I''m drawing the cursor. I tried calling invalidate on the previous rectangle being drawn, but it creates an continous loop. Is this the best way to draw a cursor that actually covers too cells? If so, how would you suggest I handle the refresh issue. Thanks again! Steve

AD Administrator Syncfusion Team February 12, 2004 06:17 AM UTC

If you are not doing all your drawing in the same cell, then there will be a problem with scrolling because when the grid scrolls a line at the time, it only repaints the single newly exposed row, and uses WindowScroll to physically scroll the portion that remains visible. This windowscrolling has to occur at row boundaries and I expect that is causing this painting problem you are seeing. You can turn off this WindowScroll support, and force the grid to repaint the whole visible grid whenever you scroll a single row. The code is this.grid.DisableScrollWindow = true;, but this will adversely affect scrolling performance. But it will be easy to see if this is what is causing the problem. Some other options include deriving the grid, overriding OnPaint, call the base class, and then if the currentcell is visible do your painting at this point. Or, you could try handling the grid.WindowScrolled event and invalidate the area you need if it is visible.

Live Chat Icon For mobile
Up arrow icon