I am creating a custom drawn Windows 10 style child frame class (derived from CMDIChildWndEx
) for MDI applications. I've got everything drawing and working well (I have one residual drawing problem, but I'll ask that separately), however I can't figure out how to get a transparent, but clickable, region outside the drawn window border.
The problem is, Windows 10 style frames are only a single pixel wide, and this is really too narrow to be practical for sizing the frame. As such, what I am trying to do, is to have a 3 pixel wide transparent region outside the border which is part of the non-client area of the window, and thus clickable. The window region is set up properly, however the 3 pixel wide region is never redrawn by the main frame, so it gets parts of other child frames "stuck" and looks a horrible mess. I assume that Windows is assuming that my window is responsible for drawing everything within its declared region, and therefore won't redraw anything in that area.
If I make the window region only extend to the 1 pixel visible border, I don't get messages (i.e. OnNcLButtonDown
, OnNcLButtonDblClk
and OnNcMouseMovewhen
the user moves the mouse outside that region, obviously.
I've tried invalidating the region I want the main frame to redraw (by calling InvalidateRect
and RedrawWindow
from my CMainFrame
class), both just the region I want redrawn, and the whole child frame region, both without success. Forcing the main frame to redraw itself and all its child frames "works", but of course results in a horrible, slow, flickering mess, so that's not a practical solution.
I've not been able to find anything online that helps, and have tried just about everything I can think of, so I'd really appreciate any suggestions!
I'm happy to show code, but hopefully the above describes the problem sufficiently.
The screenshot below shows the effect, with the borders of each child frame having been corrupted by the other as it was dragged over.