Graphics.CopyFromScreen メソッド (Point, Point, Size)
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Sub CopyFromScreen ( _ upperLeftSource As Point, _ upperLeftDestination As Point, _ blockRegionSize As Size _ )
Dim instance As Graphics Dim upperLeftSource As Point Dim upperLeftDestination As Point Dim blockRegionSize As Size instance.CopyFromScreen(upperLeftSource, upperLeftDestination, blockRegionSize)
public void CopyFromScreen ( Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize )
public: void CopyFromScreen ( Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize )
public void CopyFromScreen ( Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize )
public function CopyFromScreen ( upperLeftSource : Point, upperLeftDestination : Point, blockRegionSize : Size )


CopyFromScreen メソッドは、イメージを重ね合わせてレイアウトする場合に便利です。転送元と転送先の色のブレンド方法を指定するには、CopyPixelOperation パラメータを受け取るいずれかの CopyFromScreen メソッドを使用します。

CopyFromScreen メソッドを使用する方法の例を次に示します。この例を実行するには、コードを Windows フォームに貼り付けます。フォームの Paint イベントを処理し、e を PaintEventArgs として渡して、Paint イベント処理メソッドから CopyPixels1 メソッドを呼び出します。


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Graphics.CopyFromScreen メソッド (Int32, Int32, Int32, Int32, Size, CopyPixelOperation)
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Sub CopyFromScreen ( _ sourceX As Integer, _ sourceY As Integer, _ destinationX As Integer, _ destinationY As Integer, _ blockRegionSize As Size, _ copyPixelOperation As CopyPixelOperation _ )
Dim instance As Graphics Dim sourceX As Integer Dim sourceY As Integer Dim destinationX As Integer Dim destinationY As Integer Dim blockRegionSize As Size Dim copyPixelOperation As CopyPixelOperation instance.CopyFromScreen(sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation)
public void CopyFromScreen ( int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation )
public: void CopyFromScreen ( int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation )
public void CopyFromScreen ( int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation )
public function CopyFromScreen ( sourceX : int, sourceY : int, destinationX : int, destinationY : int, blockRegionSize : Size, copyPixelOperation : CopyPixelOperation )
- copyPixelOperation
CopyPixelOperation 値の 1 つ。


CopyFromScreen メソッドは、イメージを重ね合わせてレイアウトする場合に便利です。copyPixelOperation パラメータでは、転送元の色を転送先の領域の色とブレンドするかどうか、およびブレンドする場合はその方法を指定できます。

CopyFromScreen メソッドを使用する方法の例を次に示します。この例を実行するには、コードを Windows フォームに貼り付けます。フォームの Paint イベントを処理し、e を PaintEventArgs として渡して、Paint イベント処理メソッドから CopyPixels4 メソッドを呼び出します。


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Graphics.CopyFromScreen メソッド (Int32, Int32, Int32, Int32, Size)
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Sub CopyFromScreen ( _ sourceX As Integer, _ sourceY As Integer, _ destinationX As Integer, _ destinationY As Integer, _ blockRegionSize As Size _ )
Dim instance As Graphics Dim sourceX As Integer Dim sourceY As Integer Dim destinationX As Integer Dim destinationY As Integer Dim blockRegionSize As Size instance.CopyFromScreen(sourceX, sourceY, destinationX, destinationY, blockRegionSize)
public void CopyFromScreen ( int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize )
public: void CopyFromScreen ( int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize )
public void CopyFromScreen ( int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize )
public function CopyFromScreen ( sourceX : int, sourceY : int, destinationX : int, destinationY : int, blockRegionSize : Size )


CopyFromScreen メソッドは、イメージを重ね合わせてレイアウトする場合に便利です。転送元と転送先の色のブレンド方法を指定するには、CopyPixelOperation パラメータを受け取るいずれかの CopyFromScreen メソッドを使用します。

CopyFromScreen を使用して現在のフォームのコピーを出力する方法を次のコード例に示します。
Imports System 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
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()); } }


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Graphics.CopyFromScreen メソッド (Point, Point, Size, CopyPixelOperation)
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Sub CopyFromScreen ( _ upperLeftSource As Point, _ upperLeftDestination As Point, _ blockRegionSize As Size, _ copyPixelOperation As CopyPixelOperation _ )
Dim instance As Graphics Dim upperLeftSource As Point Dim upperLeftDestination As Point Dim blockRegionSize As Size Dim copyPixelOperation As CopyPixelOperation instance.CopyFromScreen(upperLeftSource, upperLeftDestination, blockRegionSize, copyPixelOperation)
public void CopyFromScreen ( Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation )
public: void CopyFromScreen ( Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation )
public void CopyFromScreen ( Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation )
public function CopyFromScreen ( upperLeftSource : Point, upperLeftDestination : Point, blockRegionSize : Size, copyPixelOperation : CopyPixelOperation )
- copyPixelOperation
CopyPixelOperation 値の 1 つ。


CopyFromScreen メソッドは、イメージを重ね合わせてレイアウトする場合に便利です。copyPixelOperation パラメータでは、転送元の色を転送先の領域の色とブレンドするかどうか、およびブレンドする場合はその方法を指定できます。

CopyFromScreen メソッドを使用する方法の例を次に示します。この例を実行するには、コードを Windows フォームに貼り付けます。フォームの Paint イベントを処理し、e を PaintEventArgs として渡して、Paint イベント処理メソッドから CopyPixels2 メソッドを呼び出します。


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Graphics.CopyFromScreen メソッド

名前 | 説明 |
---|---|
Graphics.CopyFromScreen (Point, Point, Size) | 画面から Graphics の描画サーフェイスへの、ピクセルの四角形に対応する色データのビット ブロック転送を実行します。 |
Graphics.CopyFromScreen (Point, Point, Size, CopyPixelOperation) | 画面から Graphics の描画サーフェイスへの、ピクセルの四角形に対応する色データのビット ブロック転送を実行します。 |
Graphics.CopyFromScreen (Int32, Int32, Int32, Int32, Size) | 画面から Graphics の描画サーフェイスへの、ピクセルの四角形に対応する色データのビット ブロック転送を実行します。 |
Graphics.CopyFromScreen (Int32, Int32, Int32, Int32, Size, CopyPixelOperation) | 画面から Graphics の描画サーフェイスへの、ピクセルの四角形に対応する色データのビット ブロック転送を実行します。 |

- Graphics.CopyFromScreenのページへのリンク