C#捕获图像请! [英] C# Capture Image Please!

查看:62
本文介绍了C#捕获图像请!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的笔记本电脑中捕获一张图片,但没有任何信息我提到我搜索了所有网站的内容。

我需要一个帮助,请问我该如何解决?



C#

I want to capture one image from my laptop computer but nothing of information i mention what i searched for all the sites.
I need one help please  I how can solve?

C#

推荐答案

有两个功能可以用来捕捉图像。

There are two function to you can use to capture the image.

1。
DrawToBitmap
方法

  private void button1_Click(object sender, EventArgs e)
        {
            Bitmap bp = new Bitmap(this.Width, this.Height);
            this.DrawToBitmap(bp, new Rectangle(0, 0, this.Width, this.Height));
            this.pictureBox1.Image = bp;
        }

2。
Graphics。 CopyFromScreen
方法

    private void button2_Click(object sender, EventArgs e)
        {
            Bitmap bp = new Bitmap(Screen.PrimaryScreen.Bounds.Size.Width, Screen.PrimaryScreen.Bounds.Size.Height);
            Graphics g = Graphics.FromImage(bp);
            g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
            this.pictureBox1.Image = bp;
        }




如果您对此问题有任何其他建议,请随时与我们联系。


If you have anything else about this issue, please feel free to contact us.

希望有所帮助,

最诚挚的问候,

Bob


这篇关于C#捕获图像请!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆