protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            //}
            //protected override void OnActivated(EventArgs e)
            //{
            base.OnActivated(e);

            int  color;
            bool blend;

            DwmApi.DwmGetColorizationColor(out color, out blend);

            int A = color >> 24 & 0xff;
            int R = color >> 16 & 0xff;
            int G = color >> 8 & 0xff;
            int B = color & 0xff;

            var winColor = Color.FromArgb(0xff,
                                          (byte)(R * A / 0xff + 0xff - A),
                                          (byte)(G * A / 0xff + 0xff - A),
                                          (byte)(B * A / 0xff + 0xff - A));

            this.Resources["WindowColorBrush"] = new SolidColorBrush(winColor);
        }
Exemple #2
0
        private void ConnectWindowToXboxApp()
        {
            if (_thumbnailId != IntPtr.Zero)
            {
                DwmApi.DwmUnregisterThumbnail(_thumbnailId);
                _thumbnailId = IntPtr.Zero;
            }

            var xboxAppHwnd = User32.FindWindow("ApplicationFrameWindow", "Xbox");
            var handle      = DwmApi.DwmRegisterThumbnail(new WindowInteropHelper(this).Handle, xboxAppHwnd);

            var props = new DWM_THUMBNAIL_PROPERTIES
            {
                dwFlags = DWM_TNP.DWM_TNP_VISIBLE |
                          DWM_TNP.DWM_TNP_RECTSOURCE |
                          DWM_TNP.DWM_TNP_RECTDESTINATION,
                fVisible = true
            };

            var captionHeight = Metrics.Frame.Height - (int)LayoutRoot.ActualHeight;

            props.rcSource      = new RECT(0, captionHeight, Metrics.Frame.Width, Metrics.Frame.Height);
            props.rcDestination = new RECT(0, 0, Metrics.Frame.Width, (int)LayoutRoot.ActualHeight);

            DwmUpdateThumbnailProperties(handle, props);
            DwmQueryThumbnailSourceSize(handle, out var sz);

            Trace.WriteLine($"DwmRegisterThumbnail: {handle} {sz}");
        }
        private void SetupDateScenarios()
        {
            // Is this future enabled?
            if (!Cfg.Default.EnableDateEvents)
            {
                return;
            }

            var  date       = DateTime.Now;
            bool IsOneApril = (date.Month == 4 && date.Day == 1);
            bool IsXmas     = (date.Month == 12);

            // TODO: add more date checks

            if (IsOneApril)
            {
                var g = this.Content as Grid;
                var t = new TransformGroup();
                t.Children.Add(new TranslateTransform(-g.ActualWidth, -g.ActualHeight));
                t.Children.Add(new ScaleTransform(-1, -1));
                g.RenderTransform = t;

                this.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
                int result = DwmApi.ExtendFrameIntoClientArea(this, 12, 194, 45, 33);
                if (result < 0)
                {
                    this.Background = SystemColors.ControlBrush;
                }
            }
            else if (IsXmas)
            {
                // TODO: add some xmas effects
            }
        }
Exemple #4
0
        /// <summary>
        ///   Tries to obtain the system accent color
        /// </summary>
        /// <returns>
        ///   A <see cref="Color" /> representing the system accent tint. If the color could not be obtained,
        ///   <c>null</c> is returned
        /// </returns>
        /// <remarks>
        ///   For a better appearance, this method only returns the accent color on Windows 8 and greater.
        ///   HACK: This is using the undocumented dwmapi entry point #137, which can vanish at any time.
        ///   TODO: Find a better way to accomplish this using documented APIs on Windows >= 8
        /// </remarks>
        public static Color?GetAccentColor()
        {
            // only on Windows >= 8
            if (Environment.OSVersion.Version < new Version(6, 2))
            {
                return(null);
            }

            // make sure DWM composition's enabled
            if (DwmApi.DwmIsCompositionEnabled(out bool composited) == 0 && composited)
            {
                try {
                    var colorizationParams = new DwmApi.DWMCOLORIZATIONPARAMS();

                    // retrieve colorization parameters
                    DwmApi.DwmGetColorizationParameters(ref colorizationParams);

                    // build color
                    return(Color.FromArgb((byte)(colorizationParams.ColorizationColor >> 16),
                                          (byte)(colorizationParams.ColorizationColor >> 8),
                                          (byte)colorizationParams.ColorizationColor));
                } catch (EntryPointNotFoundException) {
                    // unsupported
                }
            }

            return(null);
        }
 public void Dispose()
 {
     if (_thumbnail != IntPtr.Zero)
     {
         DwmApi.DwmUnregisterThumbnail(_thumbnail);
     }
 }
Exemple #6
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            switch (m.Msg)
            {
            case 0xf:
                OperatingSystem os = Environment.OSVersion;
                if (os.Platform == PlatformID.Win32NT)
                {
                    if (os.Version.Major >= 6)
                    {
                        if (DwmApi.DwmIsCompositionEnabled())
                        {
                            if (_image != null)
                            {
                                this.CreateGraphics().DrawImage(_image, _rect);
                            }

                            GlassRenderer.DrawText(base.Handle, _text, _font,
                                                   new Rectangle(_location, _size), _glow);
                        }
                    }
                }
                break;

            case 0x14:
                m.Result = IntPtr.Zero;
                break;
            }
        }
Exemple #7
0
        private void Form1_Resize(object sender, EventArgs e)
        {
            if (m_hThumbnail != IntPtr.Zero)
            {
                DwmApi.DWM_THUMBNAIL_PROPERTIES m_ThumbnailProperties =
                    new DwmApi.DWM_THUMBNAIL_PROPERTIES();
                m_ThumbnailProperties.dwFlags =
                    DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_VISIBLE +
                    DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_OPACITY +
                    DwmApi.DWM_THUMBNAIL_PROPERTIES.DWM_TNP_RECTDESTINATION +
                    DwmApi.DWM_THUMBNAIL_PROPERTIES.
                    DWM_TNP_SOURCECLIENTAREAONLY;
                m_ThumbnailProperties.opacity           = 255;
                m_ThumbnailProperties.fVisible          = true;
                m_ThumbnailProperties.rcSource          =
                    m_ThumbnailProperties.rcDestination = new DwmApi.RECT(0, 0,
                                                                          ClientRectangle.Right, ClientRectangle.Bottom);
                m_ThumbnailProperties.fSourceClientAreaOnly = true;

                DwmApi.DwmUpdateThumbnailProperties(
                    m_hThumbnail, m_ThumbnailProperties);


                ClientSize = new Size(ClientSize.Width, (int)(heightRatio * (double)ClientSize.Width / (double)widthRatio));
            }
        }
        /// <summary>
        /// Initialize Dwm Composition parameters
        /// </summary>
        public void Init()
        {
            bool dwmEnabled;

            DwmApi.DwmIsCompositionEnabled(out dwmEnabled);

            IsDwmCompositionEnabled = dwmEnabled;

            if (dwmEnabled)
            {
                uint color;
                bool opaqueBlend;
                DwmApi.DwmGetColorizationColor(out color, out opaqueBlend);

                DwmColorizationColor = Color.FromArgb((int)color);
                if (DwmColorizationColor.A < 100)
                {
                    DwmColorizationColor = Color.FromArgb(100, DwmColorizationColor);
                }
            }

            _bbParams          = new DwmApi.DWM_BLURBEHIND();
            _bbParams.dwFlags  = DwmApi.DwmFlags.DWM_BB_ENABLE;
            _bbParams.fEnable  = true;
            _bbParams.hRgnBlur = IntPtr.Zero;
        }
    void MainWindow_SourceInitialized(object sender, EventArgs e)
    {
        var helper = new WindowInteropHelper(this);
        var hwnd   = helper.Handle;
        var src    = HwndSource.FromHwnd(hwnd);

        src.CompositionTarget.BackgroundColor = Colors.Transparent;
        WindowChrome.SetWindowChrome(this, new WindowChrome {
            CaptionHeight         = 500,
            CornerRadius          = new CornerRadius(0),
            GlassFrameThickness   = new Thickness(0),
            NonClientFrameEdges   = NonClientFrameEdges.None,
            ResizeBorderThickness = new Thickness(0),
            UseAeroCaptionButtons = false
        });
        GraphicsPath path = new GraphicsPath(FillMode.Alternate);

        path.StartFigure();
        path.AddArc(new RectangleF(0, 0, 500, 500), 0, 360);
        path.CloseFigure();
        var dbb = new DwmBlurBehind(true);

        dbb.SetRegion(Graphics.FromHwnd(hwnd), new Region(path));
        DwmApi.DwmEnableBlurBehindWindow(hwnd, ref dbb);
    }
Exemple #10
0
        private void frmAbout_Load(object sender, EventArgs e)
        {
            // AeroGlassをかける
            if (enableGlass)
            {
                this.BackColor            = Color.Black;
                panel1.BackColor          = Color.Black;
                okButton.Font             = new Font(Properties.Resources.AboutFont, okButton.Font.Size, okButton.Font.Style);
                label1.Text               = string.Empty;
                pictureBox1.Visible       = false;
                panel1.DrawText           = version;
                panel1.TextFont           = new Font(Properties.Resources.AboutFont, 9, FontStyle.Regular);
                panel1.TextLocation       = new Point(55, 35);
                panel1.TextSize           = new Size(panel1.Width - panel1.TextLocation.X, panel1.Height - panel1.TextLocation.Y);
                panel1.GlowSize           = 10;
                panel1.DrawImage          = icons.icon48;
                panel1.DrawImageRectangle = new Rectangle(3, 37, 48, 48);

                ResetDwmBlurBehind();

                m_glassMargins = new DwmApi.MARGINS(-1, 0, 0, 0);

                if (DwmApi.DwmIsCompositionEnabled())
                {
                    DwmApi.DwmExtendFrameIntoClientArea(this.Handle, m_glassMargins);
                }
                this.FormBorderStyle = FormBorderStyle.FixedDialog;
            }
            else
            {
                label1.Text       = version;
                pictureBox1.Image = icons.icon48;
                this.BackColor    = SystemColors.Control;
            }
        }
 private IntPtr WndProc(
     IntPtr hwnd,
     int msg,
     IntPtr wParam,
     IntPtr lParam,
     ref bool handled)
 {
     try
     {
         if (msg == 803)
         {
             lock (DummyTaskbarWindow.sync)
             {
                 int         num1        = lParam.ToInt32() >> 16 & (int)ushort.MaxValue;
                 int         num2        = lParam.ToInt32() & (int)ushort.MaxValue;
                 BitmapImage bitmapImage = new BitmapImage();
                 bitmapImage.BeginInit();
                 bitmapImage.UriSource         = new Uri(this.TaskbarThumbnailPath);
                 bitmapImage.DecodePixelWidth  = num1;
                 bitmapImage.DecodePixelHeight = num2;
                 bitmapImage.EndInit();
                 Bitmap bitmap = ImageUtils.BitmapImage2Bitmap(bitmapImage);
                 DwmApi.DwmSetIconicThumbnail(new HWND(DummyTaskbarWindow.sThisHandle), (HBITMAP)bitmap.GetHbitmap(), DwmApi.DWM_SETICONICPREVIEW_Flags.DWM_SIT_NONE);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Warning("Exception in setting taskbar thumbnail : " + ex.ToString());
     }
     return(IntPtr.Zero);
 }
        /// <summary>Creates a new <see cref="GitExtensionsForm"/> indicating position restore.</summary>
        /// <param name="enablePositionRestore">Indicates whether the <see cref="Form"/>'s position
        /// will be restored upon being re-opened.</param>
        protected GitExtensionsForm(bool enablePositionRestore)
        {
            var needsPositionSave = enablePositionRestore;

            _needsPositionRestore = enablePositionRestore;

            FormClosing += GitExtensionsForm_FormClosing;

            var cancelButton = new Button();

            cancelButton.Click += CancelButtonClick;
            CancelButton        = cancelButton;

            if (ThemeModule.IsDarkTheme)
            {
                // Warning: This call freezes the CI in AppVeyor, however dark theme is not used on build machines
                DwmApi.UseImmersiveDarkMode(Handle, true);
            }

            void GitExtensionsForm_FormClosing(object sender, FormClosingEventArgs e)
            {
                if (!needsPositionSave)
                {
                    return;
                }

                needsPositionSave = false;
                _windowPositionManager.SavePosition(this);
                TaskbarProgress.Clear();
            }
        }
Exemple #13
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (!DwmApi.CheckAeroEnabled())
     {
         rbAero.IsEnabled = false;
     }
 }
        public bool?TryExtendAeroGlass()
        {
            Brush color = this.Background;

            if (!Cfg.Default.EnableAeroInterface)
            {
                this.Background = color;
                return(false);
            }

            this.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

            // Extend Aero glass into client area
            int result = DwmApi.ExtendFrameIntoClientArea(this, -1, -1, -1, -1);

            if (result < 0)
            {
                this.Background = color;
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #15
0
        public YamuiSmokeScreen(Form owner, Rectangle pageRectangle)
        {
            SetStyle(ControlStyles.UserPaint |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.ResizeRedraw |
                     ControlStyles.OptimizedDoubleBuffer, true);

            _pageRectangle           = pageRectangle;
            FormBorderStyle          = FormBorderStyle.None;
            ControlBox               = false;
            ShowInTaskbar            = false;
            StartPosition            = FormStartPosition.Manual;
            Location                 = owner.PointToScreen(_pageRectangle.Location);
            _sizeDifference          = new Point(owner.Width - _pageRectangle.Width, owner.Height - _pageRectangle.Height);
            ClientSize               = new Size(owner.Width - _sizeDifference.X, owner.Height - _sizeDifference.Y);
            owner.LocationChanged   += Cover_LocationChanged;
            owner.ClientSizeChanged += Cover_ClientSizeChanged;
            owner.VisibleChanged    += Cover_OnVisibleChanged;

            // Disable Aero transitions, the plexiglass gets too visible
            if (Environment.OSVersion.Version.Major >= 6)
            {
                int value = 1;
                DwmApi.DwmSetWindowAttribute(owner.Handle, DwmApi.DwmwaTransitionsForcedisabled, ref value, 4);
            }

            base.Opacity = 0d;
            Show(owner);
            owner.Focus();
        }
        /// <summary>
        /// Prevent this window from fading when Live Preview or Aero Peek is performed
        /// </summary>
        public void DisableLivePreview(IntPtr hwnd)
        {
            var status = Marshal.AllocHGlobal(sizeof(int));

            Marshal.WriteInt32(status, 1); // true
            int res = DwmApi.DwmSetWindowAttribute(hwnd, DwmApi.DWMWINDOWATTRIBUTE.DWMWA_EXCLUDED_FROM_PEEK, status, sizeof(int));
        }
        private async void UpdaterForm_Load(object sender, EventArgs e)
        {
            try
            {
                if (DwmApi.DwmIsCompositionEnabled())
                {
                    DwmApi.DwmExtendFrameIntoClientArea(Handle, new DwmApi.MARGINS(10, 12, 10, 12));
                }
            }
            catch (Exception)
            {
                //
            }

            lbl_CurrentV.Text = $@"Current Version: v{Assembly.GetEntryAssembly()?.GetName().Version}";

            var gitVersion = await Updater.GetGitHubVersion();

            lbl_LatestV.Text = $@"Latest Version: v{gitVersion}";

            richTextBox1.Text = await Updater.GetChangeLog();

            if (gitVersion > Assembly.GetExecutingAssembly().GetName().Version)
            {
                return;
            }

            btnSmall1.Enabled = false;
        }
Exemple #18
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case Win32.WM_PAINT:
                // ガラス効果が使えるか確認
                OperatingSystem os = Environment.OSVersion;
                if ((os.Platform == PlatformID.Win32NT) && (os.Version.Major >= 6) &&
                    (DwmApi.DwmIsCompositionEnabled()))
                {
                    this.BackColor         = Color.Black;
                    extendedPanel1.Visible = true;
                    messageLabel.Visible   = false;

                    Win32.MARGINS mar = new Win32.MARGINS();
                    mar.m_Left   = -1;
                    mar.m_Right  = 0;
                    mar.m_Bottom = 0;
                    mar.m_Top    = 0;
                    Win32.DwmExtendFrameIntoClientArea(this.Handle, ref mar);

                    // 文字描画
                    SizeF textsize = extendedPanel1.CreateGraphics().MeasureString(labelText, new Font(Properties.Resources.AboutFont, 12));
                    extendedPanel1.DrawText     = labelText;
                    extendedPanel1.TextLocation = new Point(0, 0);
                    extendedPanel1.TextSize     = textsize.ToSize();
                    extendedPanel1.GlowSize     = 7;
                    this.Size = new
                                Size((int)textsize.Width + extendedPanel1.GlowSize + 10, (int)textsize.Height + extendedPanel1.GlowSize + 15);
                    this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width,
                                              Screen.PrimaryScreen.WorkingArea.Height - this.Height - 2);
                }
                else
                {
                    this.BackColor       = SystemColors.Control;
                    this.Opacity         = 0.9;
                    this.Padding         = new Padding(10);
                    messageLabel.Text    = labelText;
                    messageLabel.Visible = true;

                    this.ClientSize = new Size(messageLabel.Size.Width + 50, messageLabel.Height + 10);
                    this.Location   = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width,
                                                Screen.PrimaryScreen.WorkingArea.Height - this.Height);
                }
                break;

            default:
                int wm_syscommand = 0x0112;
                int sc_move       = 0xF010;
                if ((m.Msg == wm_syscommand) && ((m.WParam.ToInt32() & 0xFFF0) == sc_move))
                {
                    m.Result = IntPtr.Zero;
                    return;
                }
                break;
            }

            base.WndProc(ref m);
        }
Exemple #19
0
 public void Position()
 {
     if (Handle != IntPtr.Zero)
     {
         User32.SetWindowPos(Handle, 0, (int)Location.Left, (int)Location.Top, (int)Location.Width, (int)Location.Height, User32.SWP_NOZORDER);
         DwmApi.CloakWindow(Handle, false);
     }
 }
Exemple #20
0
        private static bool ExtendedFrameBounds(IntPtr handle, out Int32Rect rectangle)
        {
            var result = DwmApi.DwmGetWindowAttribute(handle, (int)DwmWindowAttributes.ExtendedFrameBounds, out NativeRect rect, Marshal.SizeOf(typeof(NativeRect)));

            rectangle = rect.ToRectangle();

            return(result >= 0);
        }
Exemple #21
0
        public void UnRegisterThumbs()
        {
            DwmApi.DwmUnregisterThumbnail(this.ThumbLeft.Thumb);
            DwmApi.DwmUnregisterThumbnail(this.ThumbRight.Thumb);

            this.ThumbLeft.Close();
            this.ThumbRight.Close();
        }
Exemple #22
0
 public static void EnableRoundedCornersIfApplicable(this Window window)
 {
     if (Environment.OSVersion.IsAtLeast(OSVersions.Windows11))
     {
         int attributeValue = (int)DwmApi.DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND;
         DwmApi.DwmSetWindowAttribute(window.GetHandle(), DwmApi.DWMWA_WINDOW_CORNER_PREFERENCE, ref attributeValue, Marshal.SizeOf(attributeValue));
     }
 }
Exemple #23
0
        private static Rectangle?GetExtendedFrameBounds(IntPtr windowHandle)
        {
            var hResult = DwmApi.DwmGetWindowAttribute(windowHandle, DwmWindowAttribute.ExtendedFrameBounds, out Rect rect, Marshal.SizeOf(typeof(Rect)));

            return(hResult == 0
                ? rect
                : (Rectangle?)null);
        }
 /// <summary>
 /// Activate/Disable live preview for current window. This window will remain visible and all others will fade out
 /// </summary>
 /// <param name="hwnd"></param>
 /// <param name="flag"></param>
 public void LivePreview(IntPtr hwnd, bool flag)
 {
     if (!IsDwmCompositionEnabled)
     {
         return;
     }
     DwmApi.DwmpActivateLivePreview((uint)(flag ? 1 : 0), hwnd, 0, 1);
 }
        protected override void WndProc(ref Message msg)
        {
            base.WndProc(ref msg); // let the normal winproc process it

            const int WM_DWMCOMPOSITIONCHANGED = 0x031E;
            const int WM_NCHITTEST             = 0x84;
            const int HTCLIENT = 0x01;

            ////当系统颜色改变时,发送此消息给所有顶级窗口
            //const int WM_SYSCOLORCHANGE = 0x0015;

            switch (msg.Msg)
            {
                #region 处理 Areo 效果

            case WM_NCHITTEST:
                if (HTCLIENT == msg.Result.ToInt32())
                {
                    // it's inside the client area

                    // Parse the WM_NCHITTEST message parameters
                    // get the mouse pointer coordinates (in screen coordinates)
                    Point p = new Point();
                    p.X = (msg.LParam.ToInt32() & 0xFFFF);  // low order word
                    p.Y = (msg.LParam.ToInt32() >> 16);     // hi order word

                    // convert screen coordinates to client area coordinates
                    p = PointToClient(p);

                    // if it's on glass, then convert it from an HTCLIENT
                    // message to an HTCAPTION message and let Windows handle it from then on
                    if (PointIsOnGlass(p))
                    {
                        msg.Result = new IntPtr(2);
                    }
                }
                break;

            case WM_DWMCOMPOSITIONCHANGED:
                if (DwmApi.DwmIsCompositionEnabled() == false)
                {
                    _RenderMode   = RenderMode.None;
                    _glassMargins = null;
                    if (_blurRegion != null)
                    {
                        _blurRegion.Dispose();
                        _blurRegion = null;
                    }
                }
                else
                {
                    InitAreo();
                }
                break;

                #endregion
            }
        }
Exemple #26
0
        // This is a trick to get Windows to treat glass as part of the caption
        // area I learned from Daniel Moth.
        protected override void WndProc(ref Message msg)
        {
            base.WndProc(ref msg);             // let the normal winproc process it

            const int WM_DWMCOMPOSITIONCHANGED = 0x031E;
            const int WM_NCHITTEST             = 0x84;
            const int HTCLIENT = 0x01;

            switch (msg.Msg)
            {
            case WM_NCHITTEST:

                if (HTCLIENT == msg.Result.ToInt32())
                {
                    // it's inside the client area

                    // Parse the WM_NCHITTEST message parameters
                    // get the mouse pointer coordinates (in screen coordinates)
                    Point p = new Point();
                    p.X = (msg.LParam.ToInt32() & 0xFFFF);                          // low order word
                    p.Y = (msg.LParam.ToInt32() >> 16);                             // hi order word

                    // convert screen coordinates to client area coordinates
                    p = PointToClient(p);

                    // if it's on glass, then convert it from an HTCLIENT
                    // message to an HTCAPTION message and let Windows handle it from then on
                    if (PointIsOnGlass(p))
                    {
                        msg.Result = new IntPtr(2);
                    }
                }
                break;

            case WM_DWMCOMPOSITIONCHANGED:
                OperatingSystem os = Environment.OSVersion;
                if ((os.Platform == PlatformID.Win32NT) && (os.Version.Major >= 6))
                {
                    if (DwmApi.DwmIsCompositionEnabled())
                    {
                        m_glassMargins = null;
                        if (m_blurRegion != null)
                        {
                            m_blurRegion.Dispose();
                            m_blurRegion = null;
                        }
                        // ガラス効果が使える
                        enableGlass = true;
                    }
                    // ガラス効果は使えない
                    enableGlass = false;
                }
                break;

            case 0xf:
                break;
            }
        }
Exemple #27
0
 private void AcPlay2_Load(object sender, EventArgs e)
 {
     //设置vista效果
     DwmApi.SetListViewVisualEffect(lsv);
     //设置盾牌图标
     DwmApi.SetShieldIcon(btnStart);
     //选择下拉列表框
     cboPlayer.SelectedIndex = 0;
 }
Exemple #28
0
        /// <summary>
        /// Extends the glassed region into the client area.
        /// </summary>
        internal static void ExtendFrame(Control window, Margins margins)
        {
            if (!DesktopCompositionEnabled)
            {
                return;
            }

            DwmApi.DwmExtendFrameIntoClientArea(window.Handle, new DwmApi.MARGINS(margins.Left, margins.Right, margins.Top, margins.Bottom));
        }
Exemple #29
0
        /// <summary>
        /// Resets the glassed area to default.
        /// </summary>
        internal static void ResetFrame(Control window)
        {
            if (!DesktopCompositionEnabled)
            {
                return;
            }

            DwmApi.DwmExtendFrameIntoClientArea(window.Handle, new DwmApi.MARGINS(0, 0, 0, 0));
        }
        /// <summary>
        /// Get handle for a window's thumbnail
        /// </summary>
        public bool RegisterThumbnail(IntPtr destHandle, IntPtr srcHandle, out IntPtr thumbnail)
        {
            thumbnail = IntPtr.Zero;
            if (!IsDwmCompositionEnabled)
            {
                return(false);
            }

            return(DwmApi.DwmRegisterThumbnail(destHandle, srcHandle, out thumbnail) == 0);
        }