public static bool IsCompositionEnabled() { try { return(DwmApi.DwmIsCompositionEnabled()); } catch (DllNotFoundException) { return(false); } }
public static void EnableBlurBehindWindow(IntPtr windowHandle, bool enable) { try { if (DwmApi.DwmIsCompositionEnabled()) { BlurBehindInformation BlurBehindInformation = new BlurBehindInformation(enable, IntPtr.Zero); DwmApi.DwmEnableBlurBehindWindow(windowHandle, ref BlurBehindInformation); return; } else { //Glass effect is not enabled -> do nothing return; } } catch (DllNotFoundException) { return; } }
internal static void EnableGlassEffect(IntPtr windowHandle, Margins margins) { try { if (DwmApi.DwmIsCompositionEnabled()) { IntPtr Handle = windowHandle; DwmApi.DwmExtendFrameIntoClientArea(Handle, ref margins); return; } else { //Glass effect is not enabled -> do nothing return; } } catch (DllNotFoundException) { return; } }