读一个bmp文件,用打点的方式画上去,但却出现奇怪的问题
fseek(BitmapFp,BitmapDataOffset,SEEK_SET);
x=0;
y=BitmapHight-1; fseek(BitmapFp,BitmapDataOffset,SEEK_SET); for(u32Loop=0;u32Loop<BitmapDataSize/3;u32Loop++)
{

fread(PixelData,3,1,BitmapFp);
DWORD color;
color=RGB(PixelData[2],PixelData[1],PixelData[0]);
SetPixel(hDC, x, y, color);
if(x==BitmapWidth)
{
y--;
x=0;
}
x++;
}这样每次读出来的象素是对的,但是,却画出来的整副图都是第一个象素的颜色,
非要在for中加上fseek才行
for(u32Loop=0;u32Loop<BitmapDataSize/3;u32Loop++)
{
                  fseek(BitmapFp,BitmapDataOffset+u32Loop*3,SEEK_SET);
fread(PixelData,3,1,BitmapFp);
DWORD color;
color=RGB(PixelData[2],PixelData[1],PixelData[0]);
SetPixel(hDC, x, y, color);
if(x==BitmapWidth)
{
y--;
x=0;
}
x++;
}
这样就可以画出正确的图象。请问何解啊?