public static void Extend(Form form, GlassMargins margins) { if (form == null) { return; } if (!GlassAvailable) { return; } try { NativeMethods.MARGINS LMargins = new NativeMethods.MARGINS(); LMargins.cxLeftWidth = margins.LeftWidth; LMargins.cxRightWidth = margins.RightWidth; LMargins.cyBottomHeight = margins.BottomHeight; LMargins.cyTopHeight = margins.TopHeight; NativeMethods.DwmExtendFrameIntoClientArea(form.Handle, ref LMargins); } catch (DllNotFoundException) { TraceDebug.Trace("DWMAPI DLL not found"); } }
public void UpdateGlassFrame() { GlassMargins margins = new GlassMargins(); if ((client.Handle != IntPtr.Zero) && (GlassHelper.CompositionEnabled)) { if (enabled) { if (sheetOfGlass) { margins.SheetOfGlass(); } else { margins.LeftWidth = left; margins.RightWidth = right; margins.BottomHeight = bottom; margins.TopHeight = top; } } else { margins.None(); } if (client.DesignedState) { client.Invalidate(); } else { GlassHelper.Extend(client, margins); client.Invalidate(); } } else { client.Invalidate(); } }