Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Using TRect


Reduce size by offset — Shrink()

An example of using Shrink to reduce the size of a TRect:

TSize size(10,10);
TRect rect(0,0,50,50);
rect.Shrink(size);

The resulting co-ordinates of rect are (10,10,40,40). The height and width have both been reduced by twenty pixels.

[Top]


Increase size by offset — Grow()

An example of using Grow to increase the size of a TRect:

TSize size(10,10);
TRect rect(0,0,50,50);
rect.Grow(size);

The resulting co-ordinates of rect are (–10,–10,60,60). The height and width have both been increased by twenty pixels.

[Top]


Get minimal bounding rectangle — BoundingRect()

An example of using BoundingRect() to get the minimal rectangle which bounds both rect1 and rect2:

TRect rect1(20,20,50,50);
TRect rect2(70,70,100,100);
rect1.BoundingRect(rect2);

The resulting co-ordinates of rect1 are (20,20,100,100).