I have a gridDataBoundGrid and when I format my grid I''m adding a covered range for a particular row:
where "i" is the index of a specific row. I''m also setting the style.BackColor to black for the first cell in the range.
Visibly everything works/looks fine, the entire row is covered and black (and I can scroll and it looks fine), but when I attempt to print the grid (using the gridFitToPrint example as a guide), the row only prints black for the area visible on the screen before I attempt to print. The rest of the row is white. Everthing else is printing correctly.
Thanks for any help you can provide.
>>I''''m also setting the style.BackColor to black for the first cell in the range.
How are you doing this? You cannot set the style of a particular cell in a GridDataBoundGrid, so you would have to use PrepareViewStyleInfo to try to handle this as described in this KB. Is this what you are doing?
TKTyler KohnNovember 11, 2004 03:48 PM UTC
yea, that''s what I''m doing, in the mygrid_PrepareViewStyleInfo method I''m setting the style. So if the cell is in the row I''m concerned with it sets the backcolor.
AdministratorNovember 11, 2004 04:39 PM UTC
I kludged up that sample to work with a griddataboundgrid, it seems to be coloring the whole covered cell for me. Can you modify it to show the problem?
TKTyler KohnNovember 11, 2004 05:17 PM UTC
Ok, managed to do it. It turns out that if I hide the first column and span the covered range from the first (now hidden) column to the end the columns you can see this occur. I understand that you might not want to include a hidden cell in a covered range (not sure what other issues might appear). But do you know why this result occurs?
Also, I noticed that if you scroll to the far right of the grid and do a print/print preview it only prints what is now currently visible. this occurs independantly of the first issue. Why is this and is how can be sure that the entire grid is printed?
AdministratorNovember 11, 2004 10:47 PM UTC
I think probably the problem is that it is the top-left cell of teh covered range that is hidden. The grid takes its queues for drawing the covered range from the top-left cell. When that cell is hidden, it is never drawn which I think is what is cusing this problem. You should try adjusting your covered ranges so the top-left cell is not hidden.
As far as the scrolling problem, the DrawGrid draws as much of the visible grid as will fit in the bounds. It does not necessary start at column 1. It stars with the first visible column. So, you should set LeftColIndex to make sure the part of the grid that you want draw is drawn in DrawGrid.
his.gridControl1.GridBounds = new Rectangle(0, 0, gridWidth, gridHeight);
this.gridControl1.LeftColIndex = 1;