Click to See Complete Forum and Search --> : Colored Rectangles


May 5th, 1999, 05:58 AM
Hi,

I want to have a rectangle object within a CFormView that allows me to change its color at runtime. Which control should I use and how can I have it change its color?

Who can help?

Jens

lenge@hft.e-technik.uni-dortmund.de

czieler
May 10th, 1999, 10:55 AM
I would create an invisible frame and then do:
(not proper coding but just to give you the idea)

1. Create a brush of the color you would like.
2. Do a GetDlgItem(IDC_FRAMENAME)->GetWindowRect(CRect variable); on that frame in the OnPaint() function.
3. Do a ScreenToClient on that rect
4. Do Rectangle(CRectVar.left,CRectVar.top,CRectVar.right,CRectVar.bottom)