What's so special about bitmaps and DCs?

Raymond Chen

You can select pens, brushes, fonts and bitmaps into a DC with the SelectObject function, and from this list, bitmaps are special. Because, if you look carefully, bitmaps are the only modifiable objects on the list. Pens, brushes and fonts cannot be modified once they are created. But bitmaps, oh, bitmaps. A bitmap selected into a DC changes as you draw into it. Selecting a bitmap into multiple DCs means that writing to the bitmap from one DC secretly changes it in another, which isn’t a very nice thing to do to a DC.

So let’s see, you can select pens, brushes, and fonts into multiple DCs, but you can’t do it with bitmaps. Coincidence? You make the call.


Discussion is closed.

Feedback usabilla icon