Graphics.CopyFromScreen 메서드
정의
오버로드
CopyFromScreen(Int32, Int32, Int32, Int32, Size) |
화면에서 Graphics의 그리기 화면으로 픽셀의 사각형에 해당하는 색 데이터 비트 블록 전송을 수행합니다.Performs a bit-block transfer of the color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics. |
CopyFromScreen(Int32, Int32, Int32, Int32, Size, CopyPixelOperation) |
화면에서 Graphics의 그리기 화면으로 픽셀의 사각형에 해당하는 색 데이터 비트 블록 전송을 수행합니다.Performs a bit-block transfer of the color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics. |
CopyFromScreen(Point, Point, Size) |
픽셀의 사각형에 해당하는 색 데이터를 화면에서 Graphics의 그리기 화면으로 bitblt(bit-block transfer)합니다.Performs a bit-block transfer of color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics. |
CopyFromScreen(Point, Point, Size, CopyPixelOperation) |
픽셀의 사각형에 해당하는 색 데이터를 화면에서 Graphics의 그리기 화면으로 bitblt(bit-block transfer)합니다.Performs a bit-block transfer of color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics. |
CopyFromScreen(Int32, Int32, Int32, Int32, Size)
화면에서 Graphics의 그리기 화면으로 픽셀의 사각형에 해당하는 색 데이터 비트 블록 전송을 수행합니다.Performs a bit-block transfer of the color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics.
public:
void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, System::Drawing::Size blockRegionSize);
public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, System.Drawing.Size blockRegionSize);
member this.CopyFromScreen : int * int * int * int * System.Drawing.Size -> unit
Public Sub CopyFromScreen (sourceX As Integer, sourceY As Integer, destinationX As Integer, destinationY As Integer, blockRegionSize As Size)
매개 변수
- sourceX
- Int32
원본 사각형 왼쪽 위 모퉁이에 있는 점의 x-좌표입니다.The x-coordinate of the point at the upper-left corner of the source rectangle.
- sourceY
- Int32
원본 사각형 왼쪽 위 모퉁이에 있는 점의 y-좌표입니다.The y-coordinate of the point at the upper-left corner of the source rectangle.
- destinationX
- Int32
대상 사각형 왼쪽 위 모퉁이에 있는 점의 x-좌표입니다.The x-coordinate of the point at the upper-left corner of the destination rectangle.
- destinationY
- Int32
대상 사각형 왼쪽 위 모퉁이에 있는 점의 y-좌표입니다.The y-coordinate of the point at the upper-left corner of the destination rectangle.
- blockRegionSize
- Size
전송할 영역의 크기입니다.The size of the area to be transferred.
예외
작업을 수행하지 못했습니다.The operation failed.
예제
다음 코드 예제를 사용 하는 방법에 설명 합니다 CopyFromScreen 현재 폼의 복사본을 인쇄 합니다.The following code example demonstrates how to use the CopyFromScreen for printing a copy of the current form.
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Printing;
public class Form1 :
Form
{
private Button printButton = new Button();
private PrintDocument printDocument1 = new PrintDocument();
public Form1()
{
printButton.Text = "Print Form";
printButton.Click += new EventHandler(printButton_Click);
printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
this.Controls.Add(printButton);
}
void printButton_Click(object sender, EventArgs e)
{
CaptureScreen();
printDocument1.Print();
}
Bitmap memoryImage;
private void CaptureScreen()
{
Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}
private void printDocument1_PrintPage(System.Object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryImage, 0, 0);
}
public static void Main()
{
Application.Run(new Form1());
}
}
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Printing
Public Class Form1
Inherits Form
Private WithEvents printButton As New Button
Private WithEvents printDocument1 As New PrintDocument
Public Sub New()
printButton.Text = "Print Form"
Me.Controls.Add(printButton)
End Sub
Dim memoryImage As Bitmap
Private Sub CaptureScreen()
Dim myGraphics As Graphics = Me.CreateGraphics()
Dim s As Size = Me.Size
memoryImage = New Bitmap(s.Width, s.Height, myGraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
memoryGraphics.CopyFromScreen(Me.Location.X, Me.Location.Y, 0, 0, s)
End Sub
Private Sub printDocument1_PrintPage(ByVal sender As System.Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles _
printDocument1.PrintPage
e.Graphics.DrawImage(memoryImage, 0, 0)
End Sub
Private Sub printButton_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles printButton.Click
CaptureScreen()
printDocument1.Print()
End Sub
Public Shared Sub Main()
Application.Run(New Form1())
End Sub
End Class
설명
CopyFromScreen 메서드 위에 다른 하나의 이미지 계층에 유용 합니다.The CopyFromScreen methods are useful for layering one image on top of another. 소스 및 대상 색 혼합 되는 방법을 지정 하려면 중 하나를 사용 합니다 CopyFromScreen 사용 하는 메서드를 CopyPixelOperation 매개 변수입니다.To specify how the source and destination colors are blended, use one of the CopyFromScreen methods that takes a CopyPixelOperation parameter.
보안
UIPermission
모든 windows에 액세스 합니다.for access to all windows. 열거형 관련: AllWindows합니다.Related enumeration: AllWindows.
추가 정보
CopyFromScreen(Int32, Int32, Int32, Int32, Size, CopyPixelOperation)
화면에서 Graphics의 그리기 화면으로 픽셀의 사각형에 해당하는 색 데이터 비트 블록 전송을 수행합니다.Performs a bit-block transfer of the color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics.
public:
void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, System::Drawing::Size blockRegionSize, System::Drawing::CopyPixelOperation copyPixelOperation);
public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, System.Drawing.Size blockRegionSize, System.Drawing.CopyPixelOperation copyPixelOperation);
member this.CopyFromScreen : int * int * int * int * System.Drawing.Size * System.Drawing.CopyPixelOperation -> unit
매개 변수
- sourceX
- Int32
원본 사각형 왼쪽 위 모퉁이에 있는 점의 x-좌표입니다.The x-coordinate of the point at the upper-left corner of the source rectangle.
- sourceY
- Int32
소스 사각형의 왼쪽 위 모퉁이에 있는 점의 Y 좌표입니다.The y-coordinate of the point at the upper-left corner of the source rectangle
- destinationX
- Int32
대상 사각형 왼쪽 위 모퉁이에 있는 점의 x-좌표입니다.The x-coordinate of the point at the upper-left corner of the destination rectangle.
- destinationY
- Int32
대상 사각형 왼쪽 위 모퉁이에 있는 점의 y-좌표입니다.The y-coordinate of the point at the upper-left corner of the destination rectangle.
- blockRegionSize
- Size
전송할 영역의 크기입니다.The size of the area to be transferred.
- copyPixelOperation
- CopyPixelOperation
CopyPixelOperation 값 중 하나입니다.One of the CopyPixelOperation values.
예외
copyPixelOperation
는 CopyPixelOperation의 멤버가 아닙니다.copyPixelOperation
is not a member of CopyPixelOperation.
작업을 수행하지 못했습니다.The operation failed.
예제
다음 예제에서는 CopyFromScreen 메서드를 사용하는 방법을 보여 줍니다.The following example demonstrates how to use the CopyFromScreen method. 이 예제를 실행 하려면 Windows 폼에 붙여 넣습니다.To run this example, paste it into a Windows Form. 양식의 처리 Paint 이벤트 및 호출 합니다 CopyPixels4
메서드에서 Paint 전달 하는 이벤트 처리 메서드를 e
으로 PaintEventArgs입니다.Handle the form's Paint event and call the CopyPixels4
method from the Paint event-handling method, passing e
as PaintEventArgs.
private void CopyPixels4(PaintEventArgs e)
{
e.Graphics.CopyFromScreen(0, 0, 20, 20, new Size(160, 160),
CopyPixelOperation.SourceInvert);
}
Private Sub CopyPixels4(ByVal e As PaintEventArgs)
e.Graphics.CopyFromScreen(0, 0, 20, 20, _
New Size(160, 160), CopyPixelOperation.SourceInvert)
End Sub
설명
CopyFromScreen 메서드 위에 다른 하나의 이미지 계층에 유용 합니다.The CopyFromScreen methods are useful for layering one image on top of another. copyPixelOperation
매개 변수를 지정 하 고 소스 색을 대상 영역의 색과 혼합 해야 하는 방법을 사용 합니다.The copyPixelOperation
parameter allows you to specify if and how the source colors should be blended with the colors in the destination area.
보안
UIPermission
모든 windows에 액세스 합니다.for access to all windows. 열거형 관련: AllWindows합니다.Related enumeration: AllWindows.
추가 정보
CopyFromScreen(Point, Point, Size)
픽셀의 사각형에 해당하는 색 데이터를 화면에서 Graphics의 그리기 화면으로 bitblt(bit-block transfer)합니다.Performs a bit-block transfer of color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics.
public:
void CopyFromScreen(System::Drawing::Point upperLeftSource, System::Drawing::Point upperLeftDestination, System::Drawing::Size blockRegionSize);
public void CopyFromScreen (System.Drawing.Point upperLeftSource, System.Drawing.Point upperLeftDestination, System.Drawing.Size blockRegionSize);
member this.CopyFromScreen : System.Drawing.Point * System.Drawing.Point * System.Drawing.Size -> unit
Public Sub CopyFromScreen (upperLeftSource As Point, upperLeftDestination As Point, blockRegionSize As Size)
매개 변수
- upperLeftSource
- Point
소스 사각형의 왼쪽 위 모퉁이에 있는 점입니다.The point at the upper-left corner of the source rectangle.
- upperLeftDestination
- Point
대상 사각형의 왼쪽 위 모퉁이에 있는 점입니다.The point at the upper-left corner of the destination rectangle.
- blockRegionSize
- Size
전송할 영역의 크기입니다.The size of the area to be transferred.
예외
작업을 수행하지 못했습니다.The operation failed.
예제
다음 예제에서는 CopyFromScreen 메서드를 사용하는 방법을 보여 줍니다.The following example demonstrates how to use the CopyFromScreen method. 이 예제를 실행 하려면 Windows 폼에 붙여 넣습니다.To run this example, paste it into a Windows Form. 양식의 처리 Paint 이벤트 및 호출 합니다 CopyPixels1
메서드에서 Paint 전달 하는 이벤트 처리 메서드를 e
으로 PaintEventArgs입니다.Handle the form's Paint event and call the CopyPixels1
method from the Paint event-handling method, passing e
as PaintEventArgs.
private void CopyPixels1(PaintEventArgs e)
{
e.Graphics.CopyFromScreen(this.Location,
new Point(40, 40), new Size(100, 100));
}
Private Sub CopyPixels1(ByVal e As PaintEventArgs)
e.Graphics.CopyFromScreen(Me.Location, _
New Point(40, 40), New Size(100, 100))
End Sub
설명
CopyFromScreen 메서드 위에 다른 하나의 이미지 계층에 유용 합니다.The CopyFromScreen methods are useful for layering one image on top of another. 소스 및 대상 색 혼합 되는 방법을 지정 하려면 중 하나를 사용 합니다 CopyFromScreen 사용 하는 메서드를 CopyPixelOperation 매개 변수입니다.To specify how the source and destination colors are blended, use one of the CopyFromScreen methods that takes a CopyPixelOperation parameter.
보안
UIPermission
모든 windows에 액세스 합니다.for access to all windows. 열거형 관련: AllWindows합니다.Related enumeration: AllWindows.
추가 정보
CopyFromScreen(Point, Point, Size, CopyPixelOperation)
픽셀의 사각형에 해당하는 색 데이터를 화면에서 Graphics의 그리기 화면으로 bitblt(bit-block transfer)합니다.Performs a bit-block transfer of color data, corresponding to a rectangle of pixels, from the screen to the drawing surface of the Graphics.
public:
void CopyFromScreen(System::Drawing::Point upperLeftSource, System::Drawing::Point upperLeftDestination, System::Drawing::Size blockRegionSize, System::Drawing::CopyPixelOperation copyPixelOperation);
public void CopyFromScreen (System.Drawing.Point upperLeftSource, System.Drawing.Point upperLeftDestination, System.Drawing.Size blockRegionSize, System.Drawing.CopyPixelOperation copyPixelOperation);
member this.CopyFromScreen : System.Drawing.Point * System.Drawing.Point * System.Drawing.Size * System.Drawing.CopyPixelOperation -> unit
매개 변수
- upperLeftSource
- Point
소스 사각형의 왼쪽 위 모퉁이에 있는 점입니다.The point at the upper-left corner of the source rectangle.
- upperLeftDestination
- Point
대상 사각형의 왼쪽 위 모퉁이에 있는 점입니다.The point at the upper-left corner of the destination rectangle.
- blockRegionSize
- Size
전송할 영역의 크기입니다.The size of the area to be transferred.
- copyPixelOperation
- CopyPixelOperation
CopyPixelOperation 값 중 하나입니다.One of the CopyPixelOperation values.
예외
copyPixelOperation
는 CopyPixelOperation의 멤버가 아닙니다.copyPixelOperation
is not a member of CopyPixelOperation.
작업을 수행하지 못했습니다.The operation failed.
예제
다음 예제에서는 CopyFromScreen 메서드를 사용하는 방법을 보여 줍니다.The following example demonstrates how to use the CopyFromScreen method. 이 예제를 실행 하려면 Windows 폼에 붙여 넣습니다.To run this example, paste it into a Windows Form. 양식의 처리 Paint 이벤트 및 호출 합니다 CopyPixels2
메서드에서 Paint 전달 하는 이벤트 처리 메서드를 e
으로 PaintEventArgs입니다.Handle the form's Paint event and call the CopyPixels2
method from the Paint event-handling method, passing e
as PaintEventArgs.
private void CopyPixels2(PaintEventArgs e)
{
e.Graphics.CopyFromScreen(this.Location, new Point(40, 40),
new Size(100, 100), CopyPixelOperation.MergePaint);
}
Private Sub CopyPixels2(ByVal e As PaintEventArgs)
e.Graphics.CopyFromScreen(Me.Location, _
New Point(40, 40), New Size(100, 100), _
CopyPixelOperation.MergePaint)
End Sub
설명
CopyFromScreen 메서드 위에 다른 하나의 이미지 계층에 유용 합니다.The CopyFromScreen methods are useful for layering one image on top of another. copyPixelOperation
매개 변수를 지정 하 고 소스 색을 대상 영역의 색과 혼합 해야 하는 방법을 사용 합니다.The copyPixelOperation
parameter allows you to specify if and how the source colors should be blended with the colors in the destination area.
보안
UIPermission
모든 windows에 액세스 합니다.for access to all windows. 열거형 관련: AllWindows합니다.Related enumeration: AllWindows.