Closed zkvii closed 3 months ago
as doc in this
add code as
D2DPanel.CompositionScaleChanged+=D2DPanel_CompositionScaleChanged;
private void D2DPanel_CompositionScaleChanged(SwapChainPanel sender, object args)
{
var nDpi=Win32Helpers.GetDpiForWindow(hwnd);
double nScaleX = 96.0f / (double)nDpi;
double nScaleY = 96.0f / (double)nDpi;
D2DPanel.RenderTransform = new ScaleTransform()
{
ScaleX = nScaleX,
ScaleY = nScaleY
};
}
I use vortice d2d lib as replace
I'm not sure if this is obvious, there is a bit of a difference between the rectangle I added in the swapchainpanel and the one drawn with D2D. the modify code as follows