Ejemplo 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);
            }
        }
Ejemplo n.º 2
0
 static Margins()
 {
     Empty = new Margins(0);
     Infinite = new Margins(-1);
 }
Ejemplo n.º 3
0
 static Margins()
 {
     Empty    = new Margins(0);
     Infinite = new Margins(-1);
 }
Ejemplo n.º 4
0
 static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset);
Ejemplo 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);
 }
Ejemplo 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);
            }
        }
Ejemplo n.º 7
0
 static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset);
Ejemplo 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);
        }