0

プラットフォーム: UBUNTU
IDE: MonoDevelop 2.8.6.3
言語: C#.NET

スクリーンショットを作成し、そのスクリーンショットをビットマップとして返​​す関数を作成しました。このような:

/* ビットマップデータを格納する変数 */
Bitmap bmp;

/* スクリーンショットを作成します。結果を変数 'bmp' に返す */
getScreenShot(bmp);

私の質問は:

スクリーンショット (つまり bmp データ) を表示するフォーム/ウィンドウ (または意味のあるもの) を作成するにはどうすればよいですか? プログラミングでやりたい。

私はこのようにそれをやろうとしました:

    public static void Main (string[] args)
    {

        Bitmap bmp = null;
        Form form = new Form
        {
            Name = "Screenshot Displayer",
            Size = new System.Drawing.Size(800, 800),
                            Location = new System.Drawing.Point(140, 170),
                             Visible=true
        };



        /* Get screenshot */
        Gdk.Global.InitCheck(ref args);
                    screenCapture.getScreenShot(bmp);

        form.BackgroundImage = bmp;
        form.Show();






    }

私もこれを試しましたが、うまくいきません。

PictureBox P = new PictureBox();  
Bitmap bmp = null;  
Form form = new Form  
{  
    Name = "Screenshot Displayer",  
    Size = new System.Drawing.Size(800, 800),  
    Location = new System.Drawing.Point(140, 170),  
    Visible=true  
};  

bmp = new Bitmap("screenshot0.bmp");  
P.Image = bmp;  
form.Controls.Add (P);  
form.Show();
4

2 に答える 2

1

ドックがフォームに入力する PictureBox を追加します。次に、次のようなスクリーンショットを表示します。

pictureBox1.Image=bmp;
于 2013-07-10T00:46:07.147 に答える