TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ygyu
NA
16
0
why does this code throw the exception
Oct 14 2003 2:25 AM
the code is following which is to lock the bitmap data to memory and copy memory data to an array. 1: ImgStream = OpenImage.OpenFile(); 2: myImage = new Bitmap(ImgStream); 3: ImgFormat = myImage.PixelFormat; 4: rec = new Rectangle(0,0,myImage.Width,myImage.Height); 5: biData = myImage.LockBits(rec,ImageLockMode.ReadWrite,ImgFormat); 6: SrcWidthBytes = myImage.Width * 4; 7: SrcBytes = myImage.Width * myImage.Height * 4; 8: BmpData = new byte[SrcBytes]; 9: System.Runtime.InteropServices.Marshal.Copy(biData.Scan0,BmpData,0,SrcBytes); The statement which generate the exception is the ninth statement, but I can't understand why this statement throw the exception.
Reply
Answers (
7
)
unsafe code:urgent
What's wrong with this? (ComboBox Filling)