回答編集履歴

1

修正

2019/09/11 06:53

投稿

YAmaGNZ
YAmaGNZ

スコア10258

test CHANGED
@@ -4,21 +4,23 @@
4
4
 
5
5
  {
6
6
 
7
- Bitmap bmp = new Bitmap(frm.Width, frm.Height);
7
+ using(Bitmap bmp = new Bitmap(frm.Width, frm.Height))
8
8
 
9
+ {
10
+
9
- frm.DrawToBitmap(bmp, new Rectangle(0, 0, frm.Width, frm.Height));
11
+ frm.DrawToBitmap(bmp, new Rectangle(0, 0, frm.Width, frm.Height));
10
12
 
11
13
 
12
14
 
13
- // ビットマップ画像として保存して表示
15
+ // ビットマップ画像として保存して表示
14
16
 
15
- string filePath = @"D:\screen.bmp";
17
+ string filePath = @"D:\screen.bmp";
16
18
 
17
- bmp.Save(filePath, ImageFormat.Bmp);
19
+ bmp.Save(filePath, ImageFormat.Bmp);
18
20
 
19
- bmp.Dispose();
21
+ Process.Start(filePath);
20
22
 
21
- Process.Start(filePath);
23
+ }
22
24
 
23
25
  }
24
26