コード例 #1
0
        public static void ToggleFullScreen(Window window)
        {
            var state = (MyWindowState)window.GetValue(FullScreenProperty);

            if (state == null)
            {
                state = new MyWindowState();
                window.SetValue(FullScreenProperty, state);
            }

            if (state.Maximized)
            {
                state.Maximized = false;

                // Restore the previous state
                window.WindowStyle = state.PrevStyle;

                //Topmost = false;
                window.WindowState = state.PrevState;
                window.ResizeMode  = state.PrevResizeMode;
            }
            else
            {
                state.Maximized = true;

                // Store the previous state
                state.PrevState      = window.WindowState;
                state.PrevStyle      = window.WindowStyle;
                state.PrevResizeMode = window.ResizeMode;

                // Max it!
                window.WindowStyle = WindowStyle.None;

                //Topmost = true;
                window.WindowState = WindowState.Maximized;
                window.ResizeMode  = ResizeMode.NoResize;
            }
        }
コード例 #2
0
        public RdsControl(Window window)
        {
            InitializeComponent();
            viewMode = ViewMode.enScaleMode;

            mainWindow = window;

            lastState = new MyWindowState();

            SetMainImageNewPic = this.ViewImage;

            //----------------------Height Animation Maximize
            heightB_Animation              = new DoubleAnimation();
            heightB_Animation.From         = 0;
            heightB_Animation.To           = 20;
            heightB_Animation.FillBehavior = FillBehavior.HoldEnd;
            heightB_Animation.Duration     = new Duration(TimeSpan.FromMilliseconds(100));

            //----------------------Height Animation Minimize
            heightE_Animation              = new DoubleAnimation();
            heightE_Animation.From         = 20;
            heightE_Animation.To           = 0;
            heightE_Animation.FillBehavior = FillBehavior.HoldEnd;
            heightE_Animation.Duration     = new Duration(TimeSpan.FromMilliseconds(100));

            //----------------------Margin Animation Down
            MarginB_Animation              = new ThicknessAnimation();
            MarginB_Animation.From         = new Thickness(0, 0, 0, 0);
            MarginB_Animation.To           = new Thickness(0, 20, 0, 0);
            MarginB_Animation.FillBehavior = FillBehavior.HoldEnd;
            MarginB_Animation.AutoReverse  = false;
            MarginB_Animation.Duration     = new Duration(TimeSpan.FromMilliseconds(100));

            //----------------------Margin Animation UP

            MarginE_Animation              = new ThicknessAnimation();
            MarginE_Animation.From         = new Thickness(0, 20, 0, 0);
            MarginE_Animation.To           = new Thickness(0, 0, 0, 0);
            MarginE_Animation.FillBehavior = FillBehavior.Stop;
            MarginE_Animation.AutoReverse  = false;
            MarginE_Animation.Duration     = new Duration(TimeSpan.FromMilliseconds(100));

            servers = new Dictionary <string, RemoteServer>();

            rdsService = new RdsReceiver(servers);
            rdsService.StartListen();
            MainWind       = this;
            ImageContainer = this.ImgContainer;
            IntPtr hBmp = Images.close_window.GetHbitmap();

            this.Close.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBmp, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
            Utils.DeleteObject(hBmp);
            IntPtr hBmp_max = Images.maximize_window.GetHbitmap();

            this.Maximize.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBmp_max, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
            Utils.DeleteObject(hBmp_max);
            IntPtr hBmp_keyboardC = Images.control_panel_1.GetHbitmap();

            this.KeyBoardControl.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBmp_keyboardC, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
            Utils.DeleteObject(hBmp_keyboardC);
            IntPtr hBmp_arrow = Images._1427375812_double_arrow_down_32.GetHbitmap();

            this.Arrow.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBmp_arrow, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
            Utils.DeleteObject(hBmp_arrow);
            IntPtr hBmp_screenMode = Images.display_mac_inv.GetHbitmap();

            this.ScreenMode.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBmp_screenMode, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
            Utils.DeleteObject(hBmp_screenMode);
        }