Flicker free drawing and WS_EX_LAYOUTRTL
I derived a class from CWnd, and am owner-drawing it. I wanted it to be
flicker free, so I used CMemDC
([url]http://www.codeproject.com/gdi/flickerfree.asp[/url]). Once I went and
the WS_EX_LAYOUTRTL style to my dialog (with NoInherit set to false) or
directly to the CWnd-derived class of my control it was just greyed out
didn't show anything, although I was drawing within it.
[ Technical details: ]
I've investigated it a bit, and it seems that either the issue is with
CMemDC, or it is with the drawing made to it. If I replace the line
pDC(&dc); with CDC* pDC(&dc); (within OnPaint) after I have applied the
WS_EX_LAYOUTRTL to it, it will mirror just fine, but will still
I will keep with the original, CMemDC line, it is, as I said, greyed
the drawing is not made to the correct rectangle. If I add this line:
dc.SetLayout(WS_EX_LAYOUTRTL); BEFORE creating the CMemDC instance, it
draw in the correct rectangle, but will not mirror or buffer the
If I comment the calls to pDC->LPtoDP and pDC->DPtoLP within the CMemDC
class it mirrors just fine, but again with flickers (and I need to
the line which sets WS_EX_LAYOUTRTL to the dc from OnPaint).
[ End of technical details ]
I looked around and found this MS article on mirroring:
[url]http://www.microsoft.com/globaldev/getwr/steps/WRG_mirror.mspx[/url]. I don't
think I need to use any client-screen conversion - the issue seems to
with the LPtoDP and DPtoLP calls, as desribed above.
Can you please advise on how to solve this? I think I'm missing
concerns the LayoutRTL style; maybe something with the behaviour of the
Also, if there is another way to achieve flicker-free drawing that
fail with RTL layouts, I'm listening.
Thanks in advance,