コード例 #1
0
        private void TimerForMenuBar_Tick(object sender, EventArgs e)
        {
            int          screenWidth          = Screen.PrimaryScreen.WorkingArea.Width;
            int          screenHeight         = Screen.PrimaryScreen.WorkingArea.Height;
            const int    MenuBarPadding       = 100;
            const double ScreenToMenuBarRatio = 3.7;

            if (CheckException.CheckNull(video.DirectVideo) &&
                !HolderForm.FormForVideo.IsDisposed)
            {
                if (Cursor.Position.Y > screenHeight - MenuBarPadding)
                {
                    if (!menuBar.IsDisposed)
                    {
                        if (this.IsActive(HolderForm.FormForVideo.Handle) ||
                            this.IsActive(menuBar.Handle) ||
                            this.IsActive(this.subForm.Handle))
                        {
                            menuBar.Show();
                            menuBar.BringToFront();
                            menuBar.TopMost  = true;
                            menuBar.Location = new Point(Convert.ToInt32(
                                                             screenWidth / ScreenToMenuBarRatio),
                                                         screenHeight - 10);
                        }
                    }
                    else
                    {
                        timerForMenuBar.Stop();
                        menuBar = null;
                    }
                }
                else
                {
                    menuBar.Hide();
                }
            }
            else
            {
                if (HolderForm.FormForVideo.IsDisposed)
                {
                    timerForProgress.Stop();
                }

                timerForMenuBar.Stop();
                menuBar.Dispose();
                menuBar = null;
            }
        }