Esempio n. 1
0
        /// <summary>
        /// Excludes the specified child control from the glass effect.
        /// </summary>
        /// <param name="parent">The parent control.</param>
        /// <param name="control">The control to exclude.</param>
        /// <exception cref="ArgumentNullException">Occurs if control is null.</exception>
        /// <exception cref="ArgumentException">Occurs if control is not a child control.</exception>
        public static void ExcludeChildFromGlass(this Control parent, Control control)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            if (!parent.Contains(control))
            {
                throw new ArgumentException("Control must be a child control.");
            }

            if (IsCompositionEnabled())
            {
                System.Drawing.Rectangle clientScreen  = parent.RectangleToScreen(parent.ClientRectangle);
                System.Drawing.Rectangle controlScreen = control.RectangleToScreen(control.ClientRectangle);

                Margins margins = new Margins(controlScreen.Left - clientScreen.Left, controlScreen.Top - clientScreen.Top,
                                              clientScreen.Right - controlScreen.Right, clientScreen.Bottom - controlScreen.Bottom);

                // Extend the Frame into client area
                DwmExtendFrameIntoClientArea(parent.Handle, ref margins);
            }
        }
Esempio n. 2
0
 static Margins()
 {
     Empty = new Margins(0);
     Infinite = new Margins(-1);
 }
Esempio n. 3
0
 static Margins()
 {
     Empty    = new Margins(0);
     Infinite = new Margins(-1);
 }
Esempio n. 4
0
 static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset);
Esempio n. 5
0
 /// <summary>
 /// Extends the window frame beyond the client area.
 /// </summary>
 /// <param name="window">The window.</param>
 /// <param name="padding">The padding to use as the area into which the frame is extended.</param>
 public static void ExtendFrameIntoClientArea(this IWin32Window window, Padding padding)
 {
     Margins m = new Margins(padding);
     DwmExtendFrameIntoClientArea(window.Handle, ref m);
 }
Esempio n. 6
0
        /// <summary>
        /// Excludes the specified child control from the glass effect.
        /// </summary>
        /// <param name="parent">The parent control.</param>
        /// <param name="control">The control to exclude.</param>
        /// <exception cref="ArgumentNullException">Occurs if control is null.</exception>
        /// <exception cref="ArgumentException">Occurs if control is not a child control.</exception>
        public static void ExcludeChildFromGlass(this Control parent, Control control)
        {
            if (control == null)
                throw new ArgumentNullException("control");
            if (!parent.Contains(control))
                throw new ArgumentException("Control must be a child control.");

            if (IsCompositionEnabled())
            {
                System.Drawing.Rectangle clientScreen = parent.RectangleToScreen(parent.ClientRectangle);
                System.Drawing.Rectangle controlScreen = control.RectangleToScreen(control.ClientRectangle);

                Margins margins = new Margins(controlScreen.Left - clientScreen.Left, controlScreen.Top - clientScreen.Top,
                    clientScreen.Right - controlScreen.Right, clientScreen.Bottom - controlScreen.Bottom);

                // Extend the Frame into client area
                DwmExtendFrameIntoClientArea(parent.Handle, ref margins);
            }
        }
Esempio n. 7
0
 static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset);
Esempio n. 8
0
        /// <summary>
        /// Extends the window frame beyond the client area.
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="padding">The padding to use as the area into which the frame is extended.</param>
        public static void ExtendFrameIntoClientArea(this IWin32Window window, Padding padding)
        {
            Margins m = new Margins(padding);

            DwmExtendFrameIntoClientArea(window.Handle, ref m);
        }