Create a picture from canvas

I have a photo showing in a large canvas. I did this by using canvas g.DrawPicture.
Now I want to create a new picture object which is a smaller rectangle within the displayed canvas.

I would appreciate any advice how to accomplish this screen grab. Thanks.

If you look at the page you’ll see there are options for displaying a rectangle from your source picture. If you wish to select a rectangle with your mouse you’ll need to implement mousedown to capture a corner, mousedrag (store the x & y parameters), and finally mouseup to capture the opposite corner. Then you can calculate the top, left, width & height parameters to pass to drawpicture.

you can also use the Clip method

Graphics.Clip ( X as Integer, Y as Integer, Width as Integer, Height as Integer ) As Graphics Creates a new Graphics object in the parent Graphics object. It has the size and shape defined by the passed parameters.

Thanks Wayne. I clearly see how to create a picture from a picture. But the current state of my canvas is the result of many small drawpictures at different locations. I guess I should be keeping a large buffer picture to reflect the current state of the canvas display, then drawing only this large picture onto the canvas. But I was wondering if there is some way to create a new picture from the current canvas state.

There is graphics.drawPicture(p,x,y) but I am trying to invent p = graphics.getPicture (x,y).

Have you tried the Canvas.DrawInto method?

[code]dim p As new Picture(Canvas1.Width, Canvas1.Height)

Canvas1.DrawInto(p.Graphics, 0, 0)

//p now contains the Canvas1 drawing[/code]