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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.