Пример #1
0
        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");
            }
        }
Пример #2
0
        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();
            }
        }