protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{
Matrix dpiScale = CurrentHwndSource.CompositionTarget.TransformToDevice;
Vector vSize = new Vector(sizeInfo.NewSize.Width, sizeInfo.NewSize.Height);
vSize = dpiScale.Transform(vSize);
int width = (int)Math.Ceiling(vSize.X);
int height = (int)Math.Ceiling(vSize.Y);
// Size the child window to be the natural size of the element.
NativeMethods.SetWindowPos(
Handle,
HWND.NULL,
0,
0,
width,
height,
SWP.NOZORDER | SWP.NOCOPYBITS);
// Size the redirected window to contain the child window.
_redirectedWindow.SetClientAreaSize(width, height);
if (IsOutputRedirectionEnabled) {
UpdateOutputRedirection();
}
base.OnRenderSizeChanged(sizeInfo);
}