Originally Posted by
Elysia
Are those coordinates relative to the window's client area or the actual control's client area?
(Hint: if the top and left are 0, then it's the control's.)
Because InvalidateRect takes coordinates relative to the window whose handle you pass. So if you pass it for your window, then you must pass coordinates where your controls are located inside the dialog.
If you just want to update specific controls, you can just call invalidate and pass the handle for those controls.
Clipping regions was the solution to avoid flickering, together with double buffering.. wow! What a learning experience... Thanx Elysia for being patient with me. You form Big part of what i've learnt this past few weeks, not to forget Mats and, of cause every else who contributed. I like learning and the only way i have in the past is to ask... I guess some people don have patience with me but you guys have...
Well, talk to you when i have a new interesting problem
FYI...
Code:
InvalidateRgn (hwnd, rgnRsl, FALSE);
Only invalidates clipped regions instead of InvalidatedRect...
First, had to select all five rectangles into memory DC by using CreateRectRgn..
Code:
// Create clipping regions for all five rectangles
rgnRdrAnt = CreateRectRgn(aptRect[0].x, aptRect[0].y, aptRect[1].x, aptRect[1].y);
rgnTrnRcv = CreateRectRgn(aptRect[2].x, aptRect[2].y, aptRect[3].x, aptRect[3].y);
rgnTrgt = CreateRectRgn(aptRect[4].x, aptRect[4].y, aptRect[5].x, aptRect[5].y);
rgnGenPar = CreateRectRgn(aptRect[6].x, aptRect[6].y, aptRect[7].x, aptRect[7].y);
rgnRsl = CreateRectRgn(aptRect[8].x, aptRect[8].y, aptRect[9].x, aptRect[9].y);
// .. then combine them into a single rectange
CombineRgn(cmbndRngs, rgnRdrAnt, rgnTrnRcv, RGN_OR);
CombineRgn(cmbndRngs, rgnTrgt, cmbndRngs, RGN_OR);
CombineRgn(cmbndRngs, rgnGenPar, cmbndRngs, RGN_OR);
CombineRgn(cmbndRngs, rgnRsl, cmbndRngs, RGN_OR);
// lastly, add to off-screen buffer
SelectClipRgn(memDC, cmbndRngs);
then only repainted the last rectangle (the results one) ... Nice exercise