Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array or collection of rectangles and resizing clent window 1

Status
Not open for further replies.

kamilas

Programmer
Jan 2, 2003
4
US
I need to draw a number(more than 20) of rectangles. Can I have an array or collection (or other container?) of rectangles. How and where do I need to declare it. Also how can I(is it possible at all) specify the size of the client window.
Thanks
 
Of course you can have an array of rectangles, you can have arrays of anything. How to declare it depends on how you want to use it: If you know exactly how much elements there will be you can declare it like this:

RECT m_rcRectangles[20];

If you don't know up front the number of elements you can declare a pointer and set the size at runtime:

RECT * m_prcRectangles;
m_prcRectangles = new RECT[x];

Where to declare it?
I assume you've wrapped your window in a class, I would declare it inside the class declaration, so it will be a member of the class.


How to specify the client area:
If it's up front (before the call to CreateWindow) you can use the AdjustWindowRect API. If not you'll have to do some calculation of your own (with GetClientRect and GetWindowRect) to size the window the desired size.
Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top