views:

95

answers:

1

I need to provide a Windows Forms control to a native application (Visual Studio).
So I create a control and provide its handle.

Then, when I check the native window using Spy++, I see that my control is wrapped in additional 'control' with window class = "Static" and title "This is a static!". I have several problems with it:

  1. Resize events sent to my control by a hosting window have to be re-sent to the "Static" so it also gets resized (otherwise my control get partially hidden within the static's size).
  2. The static does not have WS_EX_CONTROLPARENT, which causes KB149501 to appear (in short, whole application hangs on lost focus).
  3. If I apply WS_EX_CONTROLPARENT, listbox within the static stops redrawing.

I think I have been doing something wrong, but I am not sure what. Google does not help, since static is a C# keyword as well so it occurs quite often in WinForms results.

A: 

I mostly solved the redrawing problem using DoubleBuffered=True, so probably this is it.
I still think I am doing something wrong, but at least it works now.

Andrey Shchekin