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

How to get DrawGrid() to draw the middle of a grid?

Thread ID:

Created:

Updated:

Platform:

Replies:

13328 Apr 26,2004 06:50 PM UTC Dec 3,2008 07:10 PM UTC WinForms 4
loading
Tags: GridControl
Don
Asked On April 26, 2004 06:50 PM UTC

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?

Administrator [Syncfusion]
Replied On 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.)

Don
Replied On April 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 ?

Administrator [Syncfusion]
Replied On 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 Stefan

Stephane _
Replied On 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?


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

;