[Newbies] Resizing a form to specific width and height

Bert Freudenberg bert at freudenbergs.de
Mon Jan 12 10:45:43 UTC 2009

On 12.01.2009, at 00:16, Matthias Korn wrote:

> Hi,
> how can I resize a form to a specific width and height by either
> stretching it on one axis or cropping it on the other axis.

Forms are fixed-size. The way you do it is by creating a new form of  
the desired extent and depth, and then copying (a part of) the old  
form into the new form, possibly scaling the pixels while doing so.

This is done by class BitBlt (for "bit block transfer") and its  
extension WarpBlt (which can do scaling and rotation too).

There are convenience methods hiding the details of form creation,  
BitBlt, and WarpBlt in class Form. E.g. "copy: aRectangle" does  
cropping, and "magnify: aRectangle by: aPoint smoothing: anInteger"  
does cropping and scaling.

BitBlt also does bit-depth conversion, color-remapping, statistics,  
and other image manipulations. It's well worth learning about :)

- Bert -

More information about the Beginners mailing list