If in the paint event I draw a rectangle and then scroll to the right and back to the left with the horizontal scroll bar the rectangle does not fully re-paint.
In the attached Sample
if you press the toggle rectangle bottom and then scroll to the right and then back to the left you will notice that the blue rectangle is not re-drawn and multiple "pieces" of the rectangle are shown.
I understand that the grid scrolls the window, so how can I paint the rectangle so that it is part of the window that SF is scrolling. Invalidating the entire grid upon scrolling is not an option as the performance is decreased.
ADAdministrator Syncfusion Team October 8, 2004 07:16 AM
Thank you for your sample.
The grid uses the Scrol/Window API when possible to do optimized scrolling. So, normally when the grid scrolls one line, it uses ScrollWindow to just move the visible rows, and only paints the single newly exposed row. So, Paint only gets called for this single row rectangle.
I think this is why you see the irratic drawing of your rectangle in your sample. If you want to do this type of drawing, you will likely have to turn off this optimized scrolling which would repaint the entire grid with every scroll. This property handles doing this.
this.gridControl1.DisableScrollWindow = true;
ADAdministrator Syncfusion Team October 8, 2004 08:18 AM
Thanks for the response. The disable scroll flag window works when using the moust and scroll bars, but if you arrow to the right and back to the left it is still broke. Perhaps the keyboard actions don''t look at this flag?
>Thank you for your sample.
>The grid uses the Scrol/Window API when possible to do optimized scrolling. So, normally when the grid scrolls one line, it uses ScrollWindow to just move the visible rows, and only paints the single newly exposed row. So, Paint only gets called for this single row rectangle.
>I think this is why you see the irratic drawing of your rectangle in your sample. If you want to do this type of drawing, you will likely have to turn off this optimized scrolling which would repaint the entire grid with every scroll. This property handles doing this.
>this.gridControl1.DisableScrollWindow = true;
ADAdministrator Syncfusion Team October 8, 2004 08:54 AM
I''ve discovered another issue with invalidation of a region returned from RangeInfoToRectangle does not invalidate the entire region.
For example, if I invalidate a rectangle that is returned from the RangeInfoToRectangle method and paint this same rectangle in the paint event only part of the rectangle is painted. I have to invalidate the entire grid to see the rectangle.
To demonstrate see the new sample. Run the project, click the Fix Rect to row and column radion button, and then click the toggle and invalidate the rectangle button. You will notice that only a partial rectangle is drawn. If you choose the invalidate entire grid button then the entire rectangle appears. Note that same issue occurs in which the entire area does not appear to be validating when toggling the rectangle on and off.
The disable scroll window switch doesn''t seem to affect this issue.
I have combined the previous issue into this example in which clicking the Fixed To Coordinates radio button will show the partial drawn rectangles when using the keyboard to scroll.
I hope this example helps. Let me know what else I can provide.
ADAdministrator Syncfusion Team October 8, 2004 09:48 AM
Here is an attempt to handle the cursor key scroll problem. It does it by erasing the object before the scroll and then redrawing it after the scroll.
I have not had a chance to look at your second sample. Maybe this technique will avoid that problem as well.
ADAdministrator Syncfusion Team October 8, 2004 01:05 PM
Yes this works, but it appears that the scrolling of the window is not scrolling my painted rectangle so to fix your invalidating the rectangle on each time a scroll occurs. Is there a way to paint my object so that it is scrolled like the rest of the grid? Performance is an issue here.
This didn''t fix the 2nd example, as an incomplete rectangle occurs before any scrolling. (See instructions in previous post to duplicate).
ADAdministrator Syncfusion Team October 8, 2004 03:41 PM
Performance is going to be a problem doing this. Exactly what is it that you want to draw?
Can you display it in a single cell or in a covered cell? If so, you can handle the CellDrawn event and decorate this existing cell at that point.
Another option is to use banner cells. Take a look at this sample to see the type of drawing this technique can be used for. Grid\Samples\Quick Start\BannerCells
The reason to try to use one of these techniques is the grid will manage these drawing techniques and has been optimized to manage these drawing tasks.
ADAdministrator Syncfusion Team October 11, 2004 08:50 AM
In this case I am drawing temporary borders arounds a group of cells. I can''t use the existing Syncfusion borders because those borders are already being utilized by the permanent borders in my application. For example, I am drawing a temporary border around a group of cells while the using is doing an action all the while the normal border feature in Syncfusion is being drawn. If I had two set''s of borders I could use that, but I want to use Syncfusion borders and my special borders while the user is doing something.
I can''t display it in 1 cell as it''s a group of cells and I don''t think I can use banner cells as I am outlining a block of cells. Merge cells is already being used elsewhere as well.
ADAdministrator Syncfusion Team October 12, 2004 12:59 AM
If you want to draw extra borders over some cell range, then you may be able to handle this on a cell by cell basis, just drawing the proper piece for a given cell. Attached is a little sample that uses the CellDrawn event to further decorate the cell after the grid has finished drawing it. It is in this event, you could add your extra border. This has the advantage that scrolling is handled by the grid.
Also in the sample is another way to go about this. Tiy can try adding an extra topmost window and draw to that window. The problem here is that you would have to move this window as the grid scrolls. The sample does not try to handle this.