I'm using the grid's DrawGrid() method to draw the grid to a graphics context, but I don't see any way to draw, say, the middle portion of the grid. The grid always draws from the first row and column, then as far as it can to the left and down as determined by the bounds parameter if the DrawGrid() method. Is there any way to offset upper-left coordinate of the drawn grid to any coordinate I want?
ADAdministrator Syncfusion Team April 26, 2004 08:56 PM UTC
You can try hiding the rows/columns you do not want grid.DrawGrid to draw. (You can do this dynamically in QueryRowCount/QueryColCount, returning e.Size = 0 for the rows/cols you do not want to see.)
DODonApril 27, 2004 10:02 AM UTC
> You can try hiding the rows/columns you do not
> want grid.DrawGrid to draw. (You can do this
> dynamically in QueryRowCount/QueryColCount,
> returning e.Size = 0 for the rows/cols you do
> not want to see.)
That's going to be really messy with what I've already got going on with the grid I'm trying to print. There's no other way to draw a portion of the grid that's doesn't have its upper-left corner at 0,0 ?
ADAdministrator Syncfusion Team April 27, 2004 05:37 PM UTC
One other alternative would be to set the GridBounds or PrintBounds such that you can then draw only the region you need by clipping the graphics context.
Suppose the grid has width = 200 and height = 100 and you want to draw the cells inside the grid that start at 50,50 and end at 150,150 at the form postion 10, 10. You could use the following logic:
Region r = graphics.Clip; // Save clip region
grid.GridBounds (or PrintBounds) = new Rectangle(10-50, 10-50, 200, 100)
graphics.IntersectClip(new Rectangle(10, 10, 150-50, 150-50));
// draw the grid here. It will draw the rectangle from (-40, -40) to (160, 60) but will clip the output to (10, 10) to (110, 110).
grpahics.Clip = r; // Reset clip region
S_Stephane _December 3, 2008 07:10 PM UTC
Do you guys have an other way of doing this or is it still the way to do it?