I think the bug is apparent: you use some region
m_rgnShape
in two places: when you set the window shape (by the way, my credit for using a right approach: many try to use transparency, which gives limited functionality and more problematic), and when you frame it.
But let's look at the description of
CDC::FrameRgn
(which should be a wrapper of Windows API
FrameRgn
): it says, it draws a border
around the region. Please see:
http://msdn.microsoft.com/en-us/library/vstudio/z45126ka.aspx[
^],
http://msdn.microsoft.com/en-us/library/a48eab8d%28v=vs.80%29.aspx[
^].
So, I think your frame is actually painted, only it is located in the invisible (or call it non-existing) area of your window, outside of its region.
Apparently, you would need another, smaller region for your frame. It should be nested in your window region and be at some uniform distance from it. This is easy to do for a round shape or combination of round and rectangular shapes, but it's quite hard to do precisely in case of other shapes, so be prepared for an ugly look and thinking on how to improve it. Either think of the mathematics of nearly-equidistant shapes (which is difficult, because regions are always combined from some shapes give by the API), or compensate the non-equidistant shapes by selection of different values for
nWidth
,
nHeight
parameters of
FrameRgn
, or give up the framing. I guess it's good to try, experiment a bit, to see how it looks.
There is one much more difficult problem about non-rectangular shapes: you will clearly see some "jagginess", because the contours of the shape are not
anti-aliased (please see
http://en.wikipedia.org/wiki/Aliasing[
^]). My idea was to combine the same technique of non-rectangular shapes with transparency of the window, by using a narrow transparent area at the edges of the window. I never tried it though; the approach looks quite sophisticated…
—SA