Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

.Net 4.5.2 breaks Aero interop

$
0
0

Hi,

I have a simple of example illustrating that a regression was introduced in .Net 4.5.2. This works in .Net 4.5.1. For the sake of discussion, I also tried the 4.5.3/4.6 preview and its still broken.

Code is simple c&p from MSDN:

voidMainWindow_Loaded(objectsender,RoutedEventArgse)

{

IntPtrmainWindowPtr =newWindowInteropHelper(this).Handle;

HwndSourcemainWindowSrc =HwndSource.FromHwnd(mainWindowPtr);

mainWindowSrc.CompositionTarget.BackgroundColor =

Colors.Transparent;

// Get System Dpi


System.Drawing.

Graphicsdesktop = System.Drawing.Graphics.FromHwnd(mainWindowPtr);

floatDesktopDpiX = desktop.DpiX;

floatDesktopDpiY = desktop.DpiY;

// Set Margins


MARGINSmargins =newMARGINS();

// Extend glass frame into client area


// Note that the default desktop Dpi is 96dpi. The  margins are


// adjusted for the system Dpi.


margins.cxLeftWidth =

Convert.ToInt32(5 * (DesktopDpiX / 96));

margins.cxRightWidth =

Convert.ToInt32(5 * (DesktopDpiX / 96));

margins.cyTopHeight =

Convert.ToInt32(((int)95) * (DesktopDpiX / 96));

margins.cyBottomHeight =

Convert.ToInt32(5 * (DesktopDpiX / 96));

inthr = DwmExtendFrameIntoClientArea(mainWindowSrc.Handle,refmargins);

//


if(hr < 0)

{

//DwmExtendFrameIntoClientArea Failed


}

}

With 4.5.1, this drew correctly and the glass was extended as expected. With 4.5.2, a "long" delay was introduced at application start up and a White rectangle flashes on top of the entire window, after the "long" delay, the window redraws properly.

As 4.5.1 did not have this flashing white rectangle, can you guys fix?

On my work PC which is slower then my home PC, the white rectangle will stay on top of the entire window for at least 1 second, so it is very obvious. On my home PC, it is a quick flash, but still noticeable.

PLEASE NOTE: this is an important issue as it makes the

DwmExtendFrameIntoClientArea() interop method completely unusable from C# / WPF. That in turn breaks all the various Ribbon control implementations out there, INCLUDING yours. Causing this white rectangle at start up.



Viewing all articles
Browse latest Browse all 18858

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>