예제 #1
0
        private void Form_Wallpaper_Load(object sender, EventArgs e)
        {
            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;


            // 생성자에서 배경에 고정되었을테니 DPI의 영향에서 벗어난다.
            // 이때 모니터 정보들을 다시 구하면 DPI의 영향을 받지 않는 해상도가 나온다.
            ScreenUtility.Initialize();


            // 그렇게 구해진 올바른 해상도로 다시 배경에 고정한다.
            if (PinToBackground())
            {
                m_waitHandle  = new EventWaitHandle(false, EventResetMode.ManualReset);
                m_onRunning   = true;
                m_checkParent = Task.Factory.StartNew(CheckParent, this.Handle);


                this.timer_check.Start();
            }
            else
            {
                this.Close();
            }
        }
예제 #2
0
        private void timer_check_Tick(object sender, EventArgs e)
        {
            bool needUpdate = false;

            lock (m_lockFlag)
            {
                needUpdate   = m_needUpdate;
                m_needUpdate = false;
            }

            if (needUpdate)
            {
                PinToBackground();
            }


            // 배경이 다른 프로그램에 의해 가려졌고
            if (ScreenUtility.IsOverlayed(this))
            {
                // 이번이 처음으로 가려진거면
                if (m_wasOverlayed == false)
                {
                    m_wasOverlayed = true;

                    if (this.AutoMute)
                    {
                        // 음소거
                        WinApi.waveOutSetVolume(IntPtr.Zero, 0);
                    }

                    if (this.AutoTogglePlay)
                    {
                        // 일시정지
                        PauseVideo();
                    }
                }
            }
            else if (m_wasOverlayed)
            {
                // 가려지지 않았고 이전에 가려진적이 있었으면

                m_wasOverlayed = false;

                // 볼륨 복구
                this.Volume = m_latestVolume;

                if (this.AutoTogglePlay)
                {
                    // 재생
                    PlayVideo();
                }
            }
        }
예제 #3
0
        //#############################################################################################

        protected bool PinToBackground()
        {
            m_isFixed = BehindDesktopIcon.FixBehindDesktopIcon(this.Handle);

            if (m_isFixed)
            {
                ScreenUtility.FillScreen(this, OwnerScreen);
            }


            return(m_isFixed);
        }