Exemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var helper     = new WindowInteropHelper(this).Handle;
            var wndStyleEx = (OverlayWindowInteractive.GetWindowLong(helper, OverlayWindowInteractive.GWL_EX_STYLE) | OverlayWindowInteractive.WS_EX_TOOLWINDOW | OverlayWindowInteractive.WS_EX_TRANSPARENT) & ~OverlayWindowInteractive.WS_EX_APPWINDOW;

            OverlayWindowInteractive.SetWindowLong(helper, OverlayWindowInteractive.GWL_EX_STYLE, wndStyleEx);
        }
Exemplo n.º 2
0
        public void SetOverlayActive(IOverlayWindowViewModel viewModel, bool wantsActive)
        {
            if (overlayWindowI == null)
            {
                overlayWindowI = new OverlayWindowInteractive()
                {
                    Owner = App.Current.MainWindow, FontSize = App.Current.MainWindow.FontSize
                };
            }

            if (overlayWindowT == null)
            {
                overlayWindowT = new OverlayWindowTransparent()
                {
                    Owner = App.Current.MainWindow, FontSize = App.Current.MainWindow.FontSize
                };
                overlayWindowT.panelCapture  = overlayWindowI.panelCapture;
                overlayWindowI.OnPanelMoved += (x, y) => overlayWindowT.SetDetailsCanvasPos(x, y);
            }

            overlayWindowI.DataContext = viewModel;
            overlayWindowT.DataContext = viewModel;

            overlayWindowI.SetOverlayActive(wantsActive);
            overlayWindowT.SetOverlayActive(wantsActive);
        }