将24位图像加载到图片框而不使用图片框的加载方法。 [英] load 24-bit image to picturebox without using the load method of the picturebox.

查看:88
本文介绍了将24位图像加载到图片框而不使用图片框的加载方法。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

            openFileDialog1.ShowDialog();

            string road = openFileDialog1.FileName;

            FileStream path = new FileStream(road,FileMode.Open);

            BinaryReader read = new BinaryReader(path);            

           位图图片=新位图(pictureBox1.Width,pictureBox1.Height);



我现在卡在这里,不知道怎么读图片的像素。我还读取了每个像素的颜色,然后通过循环将其放在图片框上。我知道这是耗时的方法,但我必须这样做。我真的很感激任何类型
的帮助。谢谢!

解决方案

可能是简单的方式吗?

 

Bitmap bitmap1 = new Bitmap(" C:\\ test.bmp");
位图bitmap2 =(位图)Bitmap.FromFile(" C:\\test.bmp");

颜色c = bitmap1.GetPixel(1,2);




            openFileDialog1.ShowDialog();
            string road = openFileDialog1.FileName;
            FileStream path = new FileStream(road, FileMode.Open);
            BinaryReader read = new BinaryReader(path);            
            Bitmap picture = new Bitmap(pictureBox1.Width, pictureBox1.Height);

i am stuck here now, don't know how to read the pixels of the picture. I also read the color of every pixel and then place it on picturebox through loop. i know this is time consuming method but i have to do in this way. i will really appreciate any type of help. Thank You!

解决方案

May be simple way will suit?

Bitmap bitmap1 = new Bitmap("C:\\test.bmp"); Bitmap bitmap2 = (Bitmap) Bitmap.FromFile("C:\\test.bmp");

Color c = bitmap1.GetPixel(1, 2);


这篇关于将24位图像加载到图片框而不使用图片框的加载方法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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