private void SetScreenArea(CaptureTypes type) { screenLeft = screenTop = 0; useArea = false; /*if(type == SettingsManager.CaptureTypes.VideoFull) * { * foreach (Screen screen in Screen.AllScreens) * { * this._screenArea = Rectangle.Union(_screenArea, screen.Bounds); * this._width = _screenArea.Width; * this._height = _screenArea.Height; * } * }*/ if (type == CaptureTypes.VideoArea) { using (SelectableVideoArea f = new SelectableVideoArea()) { if (f.ShowDialog() == DialogResult.OK) { this.WindowState = FormWindowState.Minimized; this._screenArea = f.AreaBounds; decimal prop = (decimal)4 / 3; decimal realProp = (decimal)f.w / f.h + 1; bool makeLonger = realProp < prop; int w = Convert.ToInt32(makeLonger ? f.h * prop : f.w); int h = Convert.ToInt32(makeLonger ? f.h : f.w / prop); if ((w & 1) != 0) { w = w + 1; } if ((h & 1) != 0) { h = h + 1; } this._width = w; this._height = h; screenLeft = f.AreaBounds.Left; screenTop = f.AreaBounds.Top; useArea = true; } } } if (type == CaptureTypes.VideoFull) { this._screenArea = Screen.PrimaryScreen.Bounds; this._width = this._screenArea.Width; this._height = this._screenArea.Height; } }
private static void SetScreenArea(CaptureTypes type) { screenLeft = screenTop = 0; useArea = false; if (type == CaptureTypes.VideoArea) { using (SelectableVideoArea f = new SelectableVideoArea()) { if (f.ShowDialog() == DialogResult.OK) { _screenArea = f.AreaBounds; decimal prop = (decimal)4 / 3; decimal realProp = (decimal)f.w / f.h + 1; bool makeLonger = realProp < prop; int w = Convert.ToInt32(makeLonger ? f.h * prop : f.w); int h = Convert.ToInt32(makeLonger ? f.h : f.w / prop); if ((w & 1) != 0) { w = w + 1; } if ((h & 1) != 0) { h = h + 1; } _width = w; _height = h; screenLeft = f.AreaBounds.Left; screenTop = f.AreaBounds.Top; useArea = true; } } } if (type == CaptureTypes.VideoFull) { _screenArea = Screen.PrimaryScreen.Bounds; _width = _screenArea.Width; _height = _screenArea.Height; } }