Exemplo n.º 1
0
        // ボタンからキャプチャ
        private void ButtonCapture_Click(System.Object sender, System.EventArgs e)
        {
            bool tmpCaptureCursorMode = Settings.Instance.CaptureCursorMode;

            if (Settings.Instance.CaptureCursorMode == true)
            {
                Settings.Instance.CaptureCursorMode = false;
            }
            int width  = 0;
            int height = 0;
            int minX   = int.MaxValue;
            int minY   = int.MaxValue;

            // 全ディスプレイの幅と高さをそれぞれ合計
            //System.Windows.Forms.Screen s = System.Windows.Forms.Screen.PrimaryScreen;
            System.Windows.Forms.Screen leftup_s = System.Windows.Forms.Screen.PrimaryScreen;
            foreach (var s in System.Windows.Forms.Screen.AllScreens)
            {
                height = height + s.Bounds.Height;
                width  = width + s.Bounds.Width;
                if (s.Bounds.X < minX)
                {
                    minX     = s.Bounds.X;
                    leftup_s = s;
                }
                if (s.Bounds.Y < minY)
                {
                    minY     = s.Bounds.Y;
                    leftup_s = s;
                }
            }

            // 画面の高さと幅をグローバル変数に設定
            ClsCapture.dHeight = height;
            ClsCapture.dWidth  = width;

            // この辺の調整が必要
            FormCaptureSheet fc = new FormCaptureSheet();

            // 'キャプチャウィンドウの位置と大きさの設定
            FormCaptureSheet fCaptureSheet = new FormCaptureSheet();

            fCaptureSheet.Opacity       = 0.4;
            fCaptureSheet.StartPosition = FormStartPosition.Manual;
            fCaptureSheet.Location      = leftup_s.Bounds.Location;
            fCaptureSheet.Width         = width;
            fCaptureSheet.Height        = height;
            fCaptureSheet.Show();
            // カーソル撮影設定を戻す
            Settings.Instance.CaptureCursorMode = tmpCaptureCursorMode;
        }
Exemplo n.º 2
0
        public void SetForm_Capture()
        {
            int width  = 0;
            int height = 0;
            int minX   = int.MaxValue;
            int minY   = int.MaxValue;

            // 全ディスプレイの幅と高さをそれぞれ合計
            //System.Windows.Forms.Screen s = System.Windows.Forms.Screen.PrimaryScreen;
            System.Windows.Forms.Screen leftup_s = System.Windows.Forms.Screen.PrimaryScreen;
            foreach (System.Windows.Forms.Screen s in System.Windows.Forms.Screen.AllScreens)
            {
                height = height + s.Bounds.Height;
                width  = width + s.Bounds.Width;
                if (s.Bounds.X < minX)
                {
                    minX     = s.Bounds.X;
                    leftup_s = s;
                }
                if (s.Bounds.Y < minY)
                {
                    minY     = s.Bounds.Y;
                    leftup_s = s;
                }
            }

            // 画面の高さと幅をグローバル変数に設定
            ClsCapture.dHeight = height;
            ClsCapture.dWidth  = width;

            //左上座標を設定
            ClsCapture.minX = minX;
            ClsCapture.minY = minY;

            FormCaptureSheet fc = new FormCaptureSheet();

            // 'キャプチャウィンドウの位置と大きさの設定
            FormCaptureSheet fCaptureSheet = new FormCaptureSheet();

            fCaptureSheet.Opacity       = 0.4;
            fCaptureSheet.StartPosition = FormStartPosition.Manual;
            fCaptureSheet.Location      = leftup_s.Bounds.Location;
            fCaptureSheet.Width         = width;
            fCaptureSheet.Height        = height;
            fCaptureSheet.ShowDialog();
        }