2011년 6월 3일 금요일

[C#] 화면캡쳐 메모리에 넣기

Size sz = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Bitmap bt = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

Graphics g = Graphics.FromImage(bt);
g.CopyFromScreen(0, 0, 0, 0, sz); // 화면캡쳐

MemoryStream ms = new MemoryStream(); // 캡쳐한 화면저장할 메모리
ms.Position = 0;

// ms버퍼에 그림을 넣는다.
bt.Save(ms, ImageFormat.Jpeg);

댓글 없음:

댓글 쓰기