Because the Win32 window handle is passed across process, it can be used to achieve inter-process UI. However, this article will not talk about specific cross-process UI will only mention a significant and ease of implementation, the way the use of child windows.
You may use after the child window, found the drag resize the window when the contents of the child window flashing. If you have encountered such a problem, then just read this article to resolve.
In this article
problem
You can look at this dynamic figure below, feel the window flashing:
In fact, when dragging the window, it is always in a flash, but each flash is very fast, gif interception when less than cut.
If you want to actually run a race to see the project, you can use the following code:
I have looked at the code extracted a submission, if you want to try, you can not use master
branches because master
branch fixes flicker problem.
Later use CreateWindowEx
to create a pure Win32 window, this flickering is more likely to be shot:
solve
public class HwndWrapper : HwndHost
{
protected override HandleRef BuildWindowCore(HandleRef hwndParent)
{
const int WS_CHILD = 0x40000000;
++ const int WS_CLIPCHILDREN = 0x02000000;
var owner = ((HwndSource)PresentationSource.FromVisual(this)).Handle;
var parameters = new HwndSourceParameters("demo")
{
ParentWindow = owner,
-- WindowStyle = (int)(WS_CHILD),
++ WindowStyle = (int)(WS_CHILD | WS_CLIPCHILDREN),
};
var source = new HwndSource(parameters);
source.RootVisual = new ChildPage();
return new HandleRef(this, source.Handle);
}
protected override void DestroyWindowCore(HandleRef hwnd)
{
}
}
the reason
We are exploring ......
Reference material
- wpf - Custom dwm drawn window frame flickers on resizing if the window contains a HwndHost element - Stack Overflow
- WPF UI exploring multi-process (Like Chrome) - Jane books
- WS_CLIPSIBLINGS WS_CLIPCHILDREN and understanding of the (personally believe it is fairly comprehensive) - helloj2ee - blog Park
My blog will be starting in https://blog.walterlv.com/ , and will be released from CSDN which featured, but it is rarely updated once released.
If you see any do not understand the contents of the blog, please share. I built dotnet Vocational and Technical College welcome to join.
This work is Creative Commons Attribution - NonCommercial - ShareAlike 4.0 International License Agreement for licensing. Welcome to reprint, use, repost, but be sure to keep the article signed by Lu Yi (containing links: https://walterlv.blog.csdn.net/ ), shall not be used for commercial purposes, a work based on the article be sure to modify the same license release. If you have any questions, please contact me .