how would i go about resizing a memory dc? i know you can set it with CreateCompatibleBitmap and SelectObject, but doing that during a window's resize event is too slow.
Why would you want to resize it anyway? Could you be more specific? maybe post some code? Thanks Latigo
A DC is exactly the size of the bitmap it contains. To change it's size, you change the bitmap. DC's are created with a single default 1x1 bitmap. Not very useful... That's why the CreateCompatibleBitmap API was invented. It allows one to create a bitmap of arbitrary size:
After you create it, you need SelectObject it into your DC. Don't forget to restore that useless default bitmap to the DC before you destroy the DC itself, or you'll leak.
HBITMAP CreateCompatibleBitmap( HDC hdc, // handle to device context int nWidth, // width of bitmap, in pixels int nHeight // height of bitmap, in pixels );
i'm working on a text display control for an irc client. i'm using DrawText to draw to the memdc and then blitting it to the window. the problem is, the text is wrapping to the window, but the bitmap won't get resized, so the text seems to be disappearing. i would kind of like to avoid resource hogging, but it seems i won't be able to.