Graphics.CopyFromScreen メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Graphics.CopyFromScreen メソッドの意味・解説 

Graphics.CopyFromScreen メソッド (Point, Point, Size)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

画面から Graphics描画サーフェイスへの、ピクセル四角形対応するデータビット ブロック転送実行します

名前空間: System.Drawing
アセンブリ: 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
)

パラメータ

upperLeftSource

転送元の四角形左上隅の点。

upperLeftDestination

転送先の四角形左上隅の点。

blockRegionSize

転送される領域サイズ

例外例外
解説解説

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

使用例使用例

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

Private Sub CopyPixels1(ByVal
 e As PaintEventArgs) 
    e.Graphics.CopyFromScreen(Me.Location, _
        New Point(40, 40), New Size(100, 100))

End Sub
private void CopyPixels1(PaintEventArgs e)
{
    e.Graphics.CopyFromScreen(this.Location, 
        new Point(40, 40), new Size(100, 100));
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.CopyFromScreen メソッド (Int32, Int32, Int32, Int32, Size, CopyPixelOperation)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

画面から Graphics描画サーフェイスへの、ピクセル四角形対応するデータビット ブロック転送実行します

名前空間: System.Drawing
アセンブリ: 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
)

パラメータ

sourceX

転送元の四角形左上隅の点の x 座標

sourceY

転送元の四角形左上隅の点の y 座標

destinationX

転送先の四角形左上隅の点の x 座標

destinationY

転送先の四角形左上隅の点の y 座標

blockRegionSize

転送される領域サイズ

copyPixelOperation

CopyPixelOperation 値の 1 つ

例外例外
例外種類条件

InvalidEnumArgumentException

copyPixelOperationCopyPixelOperationメンバではありません。

Win32Exception

操作失敗しました

解説解説
使用例使用例

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

Private Sub CopyPixels4(ByVal
 e As PaintEventArgs) 
    e.Graphics.CopyFromScreen(0, 0, 20, 20, _
        New Size(160, 160), CopyPixelOperation.SourceInvert)
End Sub
private void CopyPixels4(PaintEventArgs e)
{
    e.Graphics.CopyFromScreen(0, 0, 20, 20, new Size(160, 160),
 
        CopyPixelOperation.SourceInvert);
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.CopyFromScreen メソッド (Int32, Int32, Int32, Int32, Size)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

画面から Graphics描画サーフェイスへの、ピクセル四角形対応するデータビット ブロック転送実行します

名前空間: System.Drawing
アセンブリ: 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
)

パラメータ

sourceX

転送元の四角形左上隅の点の x 座標

sourceY

転送元の四角形左上隅の点の y 座標

destinationX

転送先の四角形左上隅の点の x 座標

destinationY

転送先の四角形左上隅の点の y 座標

blockRegionSize

転送される領域サイズ

例外例外
解説解説

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());
    }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.CopyFromScreen メソッド (Point, Point, Size, CopyPixelOperation)

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

画面から Graphics描画サーフェイスへの、ピクセル四角形対応するデータビット ブロック転送実行します

名前空間: System.Drawing
アセンブリ: 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
)

パラメータ

upperLeftSource

転送元の四角形左上隅の点。

upperLeftDestination

転送先の四角形左上隅の点。

blockRegionSize

転送される領域サイズ

copyPixelOperation

CopyPixelOperation 値の 1 つ

例外例外
例外種類条件

InvalidEnumArgumentException

copyPixelOperationCopyPixelOperationメンバではありません。

Win32Exception

操作失敗しました

解説解説
使用例使用例

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

Private Sub CopyPixels2(ByVal
 e As PaintEventArgs) 
    e.Graphics.CopyFromScreen(Me.Location, _
        New Point(40, 40), New Size(100, 100),
 _
        CopyPixelOperation.MergePaint)
End Sub
private void CopyPixels2(PaintEventArgs e)
{
    e.Graphics.CopyFromScreen(this.Location, new
 Point(40, 40), 
        new Size(100, 100), CopyPixelOperation.MergePaint); 
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Graphics.CopyFromScreen メソッド



このページでは「.NET Framework クラス ライブラリ リファレンス」からGraphics.CopyFromScreen メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からGraphics.CopyFromScreen メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からGraphics.CopyFromScreen メソッドを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Graphics.CopyFromScreen メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Graphics.CopyFromScreen メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS