开发者

Displaying byte values in the picturebox control

开发者 https://www.devze.com 2022-12-21 13:12 出处:网络
i am currentl开发者_开发技巧y working on a project which deals with the reading of satellite images of \".0FM\" format and its size is around 8Mb. Now i have been successful in converting the file(\"*

i am currentl开发者_开发技巧y working on a project which deals with the reading of satellite images of ".0FM" format and its size is around 8Mb. Now i have been successful in converting the file("*.0FM") content into a byte array. Now the byte array has integer values ranging from 0 - 255. I have to display this byte array in a picturebox control. Below is the code that i have implemented, (it runs without errors, but nothing is displayed...) code:

Bitmap^ bmp = gcnew Bitmap( 3000 , 3000 );

 long int ct = 0; //...declared as long as there are 80,00,000 elements in buf_int array
 int i,j;

 pictureBox1->Width = 3000;
 pictureBox1->Height = 3000;

for(i=0 ; i<300 ; i++)  
{  
for(j=0 ; j<300 ; j++)  
  {  
   bmp->SetPixel(i,j,Color::FromArgb((int)buf_int[ct] ));  
   pictureBox1->Image = bmp;  
   pictureBox1->Show();
   ct++;
  }

} 

Plz do help me out on this one, Thanks.....


I guess you already answer this. However, you should rewrite like this:

bmp->SetPixel(Xcount,Ycount,Color::FromArgb((int)buf_int[ct],Color::Black));

The last parameter is the color you want to change over the range of your buffer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号