public HandleBackground(Form form, Margins m) { _margins = m; //Hook form.Paint += new PaintEventHandler(form_Paint); }
/// <summary> /// Adds a handler on the Form that enables the user to move the window around /// by clicking on a glass margin (or the title bar, as usual). /// </summary> /// <param name="form">The form that will be controlled.</param> /// <param name="margins">Margins of the glass sheet.</param> /// <remarks> /// Eventual UI elements on the glass sheet will prevent the handler from receiving events /// (except the ThemeText control, which manually redirects mouse events to the form). /// </remarks> public static void HandleFormMovementOnGlass(Form form, Margins margins) { HandleFormMovement tmpHandler = new HandleFormMovement(form, margins); }
/// <summary> /// Adds a handler on the Form that automatically paints the glass background black /// </summary> /// <param name="form">The form that will be controlled.</param> /// <param name="margins">Margins of the glass sheet.</param> public static void HandleBackgroundPainting(Form form, Margins margins) { HandleBackground tmpHandler = new HandleBackground(form, margins); }
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset);
/// <summary>Extends the Aero "Glass Frame" into the client area. Background must be black.</summary> public static void EnableGlassFrame(IntPtr hWnd, Margins margins) { InternalGlassFrame(hWnd, margins); }
/// <summary>Extends the Aero "Glass Frame" into the client area. Background must be black.</summary> public static void EnableGlassFrame(Form window, Margins margins) { InternalGlassFrame(window.Handle, margins); }
private static void InternalGlassFrame(IntPtr hWnd, Margins margins) { if (!OsSupport.IsVistaOrBetter || !OsSupport.IsCompositionEnabled) return; if (NativeMethods.DwmExtendFrameIntoClientArea(hWnd, ref margins) != 0) throw new DwmCompositionException(String.Format(Resources.ExceptionMessages.NativeCallFailure, "DwmExtendFrameIntoClientArea")); }
public HandleFormMovement(Form form, Margins margins) { _margins = margins; //Register handlers form.MouseDown += new MouseEventHandler(form_MouseDown); form.MouseUp += new MouseEventHandler(form_MouseUp); form.MouseMove += new MouseEventHandler(form_MouseMove); }