I have an unmanged MFC app that is using CWnd::CreateControl to activate ATL
Composite controls. This is an existing production app that is working fine
with the ATL controls. I am building a new C# Composite control on the CLR
using UserControl as the base class and activating it with the existing MFC
code through InteropServices. The .Net UserControl (ctlCodec) has 4 buttons,
a textbox, and a listbox. The ctlCodec control is activated in my MFC app
within a ScrollView using the following pseudocode:
CWnd::SetRedraw(FALSE)
CWnd::CreateControl()
InitializeControl { }
CWnd::SetRedraw(TRUE)
CWnd::InvalidateRect(NULL)
The InvalidateRect call is causing a Paint event to occur for ctlCodec
(which I would expect), but no Paint events are occurring for the child
controls (such as the buttons on the C# composite control). So where the
child controls should be showing I have empty space displaying the
background color of the containing MFC window. However, if I mouse over one
of the buttons I then get a paint event for that button as well as the other
child controls and all is well. Only if I mouse over one of the buttons
though. The textbox or lisbox will not cause a Paint of the children. I need
to know why the child controls do not receive a Paint message on initial
display when the parent ctlCodec does. Shouldn't it pass the Paint message
on to all the contained controls? I need help in resolving this. Thanks.