Type Default Value Read Only Static Description
XRect Entire image. No No The selected portion of the image.

When you are drawing an image into a Canvas ImageGlue assumes that you want to draw the whole of that image. But sometimes you may want to draw only a small part of the image. You can use this parameter to specify the part of the image you would like drawn.


Here we draw an image that has been cropped of 10 pixels on every side. We assume the image is bigger than 20x20.

Note that when auto-sizing the Canvas, we use the image bounding box, not the image selection. So the Canvas is bigger than what is actually drawn. Set the desired Canvas size manually if this is not what you want.


Canvas canvas = new Canvas();
XImage image = XImage.FromFile(Server.MapPath("rez/boat.gif"));
DrawOptions drawOpts = new DrawOptions();
drawOpts.Selection = new XRect(10, 10, image.Width - 20, image.Height - 20);
canvas.DrawImage(image, drawOpts);

[Visual Basic]

Dim canvas As New Canvas()
Dim image As XImage = XImage.FromFile(Server.MapPath("rez/boat.gif"))
Dim drawOpts As New DrawOptions()
drawOpts.Selection = New XRect(10, 10, image.Width - 20, image.Height - 20)
canvas.DrawImage(image, drawOpts)