3

The MSDN says that:

Locks a Bitmap into system memory.

nothing much is explained.

  • What does it actually mean by "Bitmap locking"?

  • How do locking work in the memory?

  • What is the benefit of locking?

user366312
  • 16,949
  • 65
  • 235
  • 452

1 Answers1

2

It locks the bitmap image (which was not directly accessable except indirectly via the Bitmap class to a memory area so that the you can have direct access to the memory of the image - that is read/write to the image memory directly using a pointer to it.

You might want to do that if you had to manipulate the image in a way that would be faster by direct access rather than read/writepexel, drawline etc.

After locking it, you need to remeber to unlock it.

See the remarks and examples of this MSDN page https://msdn.microsoft.com/en-us/library/5ey6h79d%28v=vs.110%29.aspx

lostbard
  • 5,065
  • 1
  • 15
  • 17