Esempio n. 1
0
 protected virtual void OnAeroGlassCompositionChanged()
 {
     if (AeroGlassCompositionChanged != null)
     {
         AeroGlassCompositionChanged.Invoke(this, new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Catches the DWM messages to this window and fires the appropriate event.
        /// </summary>
        /// <param name="m"></param>

        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            if (m.Msg == DWMMessages.WM_DWMCOMPOSITIONCHANGED ||
                m.Msg == DWMMessages.WM_DWMNCRENDERINGCHANGED)
            {
                if (AeroGlassCompositionChanged != null)
                {
                    AeroGlassCompositionChanged.Invoke(this,
                                                       new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled));
                }
            }

            base.WndProc(ref m);
        }
Esempio n. 3
0
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (msg == DWMMessages.WM_DWMCOMPOSITIONCHANGED ||
                msg == DWMMessages.WM_DWMNCRENDERINGCHANGED)
            {
                if (AeroGlassCompositionChanged != null)
                {
                    AeroGlassCompositionChanged.Invoke(this,
                                                       new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled));
                }

                handled = true;
            }
            return(IntPtr.Zero);
        }
Esempio n. 4
0
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            switch (msg)
            {
            case DwmMessages.WmDwmCompositionChanged:
            case DwmMessages.WmDwmNcRenderingChanged:
                AeroGlassCompositionChanged.Invoke(this, new AeroGlassCompositionChangedEventArgs(AeroGlassCompositionEnabled));
                handled = true;
                break;

            case DwmMessages.WmNcCalcSize:
                handled = DrawOnTitleBar;
                break;

            case DwmMessages.WmNcHitTest:
                if (!(handled = DrawOnTitleBar))
                {
                    break;
                }
                var result = IntPtr.Zero;
                handled = DesktopWindowManagerNativeMethods.DwmDefWindowProc(hwnd, msg, wParam, lParam, ref result) != 0;
                if (handled)
                {
                    return(result);
                }
                if (WindowState == WindowState.Maximized)
                {
                    return(new IntPtr(1));                                          // no necessary to change the size when maximized
                }
                var       mouse = new Point(lParam.ToInt32() & 0xFFFF, lParam.ToInt32() >> 16);
                const int border = 6;
                double    right = Left + ActualWidth, bottom = Top + ActualHeight;
                return(new IntPtr(
                           mouse.X - Left <= border
                                ? mouse.Y - Top <= border ? 13 : bottom - mouse.Y <= border ? 16 : 10   // top bottom left
                            : right - mouse.X <= border
                                ? mouse.Y - Top <= border ? 14 : bottom - mouse.Y <= border ? 17 : 11   // top bottom right
                                : mouse.Y - Top <= border ? 12 : bottom - mouse.Y <= border ? 15 : 1)); // top bottom normal

            default:
                handled = false;
                break;
            }
            return(IntPtr.Zero);
        }