public static void Main(string[] args) { using (copyScreen copyScreen = new copyScreen("%" + date.Now.Ticks.toString() + ".gif", 1000 / 24)) { Console.WriteLine("press quit to exit."); while (Console.ReadLine() != "quit") { ; } } }
/// <summary> /// 开始截屏 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void startButton_Click(object sender, EventArgs e) { int left = parse(leftTextBox.Text, 0), right = parse(rightTextBox.Text, Screen.PrimaryScreen.WorkingArea.Right); int top = parse(topTextBox.Text, 0), bottom = parse(bottomTextBox.Text, Screen.PrimaryScreen.WorkingArea.Bottom); if (left > right) { int temp = left; left = right; right = temp; } if (top > bottom) { int temp = top; top = bottom; bottom = temp; } leftTextBox.Text = left.toString(); rightTextBox.Text = right.toString(); topTextBox.Text = top.toString(); bottomTextBox.Text = bottom.toString(); if (left < right && top < bottom) { setEnabled(fileButton.Enabled = false); int frame = parse(frameTextBox.Text, 24); if (frame <= 0 || frame > 24) { frame = 24; } frameTextBox.Text = frame.toString(); string fileName = fileNameTextBox.Text.Trim(); if (fileName.Length == 0 || fileName == currentFileName) { fileNameTextBox.Text = fileName = fastCSharp.io.file.BakPrefix + ((ulong)date.NowSecond.Ticks).toHex16() + ((uint)pub.Identity).toHex8(); } try { copyScreen = new copyScreen(fileName + gifFileName, (double)1000 / frame, left, top, right - left, bottom - top); currentFileName = fileName; stopButton.Enabled = true; } catch (Exception error) { MessageBox.Show(error.ToString()); setEnabled(true); fileButton.Enabled = currentFileName != null; } } }