I need to host a Win32 window in a Windows Form control. I had the same problem with WPF and I solved this problem by using the HwndHost
control.
I followed this tutorial:
Walkthrough: Hosting a Win32 Control in WPF
Is there any equivalent control in Windows Form?
I have a Panel
and its Handle
property, I use this handle as parent of my Direct2D render target window:
hwnd = CreateWindow(
L"SVGCoreClassName", // class name
L"", // window name
WS_CHILD | WS_VISIBLE, // style
CW_USEDEFAULT, // x
CW_USEDEFAULT, // y
CW_USEDEFAULT, // width
CW_USEDEFAULT, // height
parent, // parent window
nullptr, // window menu
HINST_THISCOMPONENT, // instance of the module to be associated with the window
this); // pointer passed to the WM_CREATE message
The code works if I use the HwndHost
parent handle with WPF. But it does not render anything if I use the System.Windows.Forms.Panel
Handle.
Aucun commentaire:
Enregistrer un commentaire