コード例 #1
0
ファイル: MainForm.cs プロジェクト: yyhfut/ZenTimings
        private void ButtonScreenshot_Click(object sender, EventArgs e)
        {
            Screenshot screenshot = new Screenshot();
            Bitmap     bitmap     = screenshot.CaptureActiveWindow();

            using (Form saveForm = new SaveForm(bitmap))
            {
                saveForm.ShowDialog();
                screenshot.Dispose();
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: nowyouare/ZenTimings
        private void ButtonScreenshot_Click(object sender, EventArgs e)
        {
            Rectangle bounds = Bounds;

            using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
            {
                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
                }

                using (Form saveForm = new SaveForm(bitmap))
                {
                    saveForm.ShowDialog();
                }
            }
        }