コード例 #1
0
ファイル: ManagerForm.cs プロジェクト: Rasifiel/OverlayApp
        public ManagerForm()
        {
            timer           = new System.Timers.Timer();
            timer.AutoReset = false;
            timer.Elapsed  += Timer_Elapsed;
            overlay_data    = new OverlayData(settings);
            InitializeComponent();
            Visible = true;
            RefreshScreenList();

            add_spot = new HotKeyComboController(addSpotControl, settings.Add_spot);
            add_spot.AddEvent(new EventHandler <KeyPressedEventArgs>(AddSpotlight));
            toggle_follow = new HotKeyComboController(toggleFollowControl, settings.Toggle_follow);
            toggle_follow.AddEvent(new EventHandler <KeyPressedEventArgs>(AddFollow));
            remove_spots = new HotKeyComboController(clearSpotsControl, settings.Remove_spots);
            remove_spots.AddEvent(new EventHandler <KeyPressedEventArgs>(RemoveSpots));

            fadeInControl.Value           = (decimal)settings.FadeInTime;
            fadeOutControl.Value          = (decimal)settings.FadeOutTime;
            spotlightRadiusControl.Value  = settings.Radius;
            featheringRadiusControl.Value = settings.Feathering_radius;
            autoHideDelayControl.Value    = settings.Autohide_delay;
            transparencyControl.Value     = settings.Transparency;

            overlay_form = new OverlayForm(screens[settings.Screen], overlay_data);
            overlay_form.Show();

            refresher = new Thread(new ThreadStart(this.UpdateState));
            refresher.Start();
        }
コード例 #2
0
        public OverlayForm(System.Windows.Forms.Screen screen, OverlayData overlay_data)
        {
            this.screen       = screen;
            this.overlay_data = overlay_data;
            InitializeComponent();

            ShowInTaskbar   = false;
            StartPosition   = System.Windows.Forms.FormStartPosition.Manual;
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // no borders
            SetBounds(screen.Bounds.Left, screen.Bounds.Top, screen.Bounds.Width, screen.Bounds.Height);
            TopMost = true;                                              // make the form always on top
            Visible = true;                                              // Important! if this isn't set, then the form is not shown at all

            // Set the form click-through
            int initialStyle = GetWindowLong(this.Handle, -20);

            SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);
            // Create device presentation parameters

            PresentationParameters p = new PresentationParameters();

            p.IsFullScreen         = false;
            p.DeviceWindowHandle   = this.Handle;
            p.BackBufferFormat     = SurfaceFormat.Vector4;
            p.PresentationInterval = PresentInterval.One;

            // Create XNA graphics device
            dev    = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, p);
            scaleX = 2.0f / dev.Viewport.Width;
            scaleY = 2.0f / dev.Viewport.Height;
            // Init basic effect
            effect = new BasicEffect(dev);

            // Extend aero glass style on form init
            OnResize(null);
            refresher = new Thread(new ThreadStart(this.RedrawCycle));
            refresher.Start();
        }