+3  A: 

If you are using offsets such as p[((y)*stride)+((x)*4)], you probably shouldn't be increasing p at all? Surely you've already handled that (x and y) with the multiplication? Also, bmpData.Stride - b.Width*4 is not (as far as I can see) a meaningful number... the stride is the rows size including padding.

Either remove the "p += ..." code, or change the offset algorithm. At the moment you are skipping data (bad) and accessing data outside of the object (very bad).

Marc Gravell
just want to let you know, I deleted the p += part and it works.Thanks for your help
BeatMe