C#如何从一个PictureBox得到一个位图 [英] C# how to get a bitmap from a picturebox

查看:136
本文介绍了C#如何从一个PictureBox得到一个位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PictureBox的一个形象。我想获得该图像为位图。

我的一条线code是:

位图default_image =(位图)pictureBox5.Image.Clone();

但我得到的是:

default_image值= NULL;

谁能帮我。


解决方案

 位图default_image =新位图(pictureBox5.Image);

您永远不会实例化一个位图这就是为什么它是

I have a image in picturebox. I want to get that image as a Bitmap.

My one line code is:

Bitmap default_image = (Bitmap)pictureBox5.Image.Clone();

But what i am getting is:

default_image value=null;

Can anyone help me.

解决方案

Bitmap default_image = new Bitmap(pictureBox5.Image);

You are never instantiating a Bitmap which is why it is null.

这篇关于C#如何从一个PictureBox得到一个位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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