Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can two DCs share one GDI object (brush, pen, etc.)?

Can two device contexts (DCs) share one GDI object, such as a brush or a pen?

like image 381
lovespring Avatar asked Sep 03 '25 05:09

lovespring


1 Answers

The documentation for SelectObject mentions that Bitmaps cannot be selected into more than one DC at a time.

Essentially this is because GDI operations can write to a bitmap, and it would be complex to manage multiple write operations at a time. However all the other GDI objects, once created (with the exception of regions - but those are always copied), are immutable, therefore have no restrictions on being selected into multiple DCs at a time.

like image 59
Chris Becke Avatar answered Sep 04 '25 20:09

Chris Becke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!