Advice on how to draw.

Objective: To create an efficient drawing class to draw virtual desktop representation to a small area of the ClientArea. I have problems loading the images in a seperated class from wndproc. (Unreferenced external HDC)

<code>hLeftHighlighted = (HBITMAP)LoadImageW(hThis, MAKEINTRESOURCEW(IDB_BORDER_LEFT_HIGHLIGHTED), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);</code>

This is probably because I have DCs in wndproc as well as external DCs as I am not sure how to handle loading / drawing outside of wndproc.

I have two classes:
<code>MultipleMonitorInfo</code>
<code>SingleMonitorInfo</code>

MultipleMonitorInfo contains (Amongst others):
<code>// Pointer to an array of all active monitors
std::vector<SingleMonitorInfo> no;</code>

SingleMonitorInfo contains (Amongst others):
<code>RECT rcMonitorArea
RECT rcWorkArea</code>

Currently it uses a for loop and many custom bitmaps to draw a representation of the monitors (Similar to 'Control Panel\All Control Panel Items\Display\Screen Resolution'). Using standard GDI commands to make hdcBuffer which is then BitBlt to screen.

I want to make a separate drawing class not only to clean up my wndproc but also to improve it a little.

What confuses me is what this class *should* do. I know I want an image or series of images from MultipleMonitorInfo, but how do I go about making that / those image(s)?

I was also wondering how this may affect my current classes, whether I should extended them so that: SingleMonitorInfo now contains three additional RECT structures (rcRelativeOuter, rcRelativeWorkArea, and rcRelativeTaskbar) MultipleMonitorInfo which will calculate the relative sizes of these rectangles when it updates the list. Though I am sure there are better methods, but unsure of the best method to approach.

I'm just asking for ideas on how other people would code this, as I am stuck!

TL;DR / How do I load images and draw to a memory / buffer DC outside of wnproc? How would I then center that DC to the client area? There will be controls located within the DC (Each monitor will be a button). To get an idea of what I am trying to achieve see:
Control Panel\All Control Panel Items\Display\Screen Resolution
Sorry, I'm having a hard time reading your code. Can you enclose the code like this (but remove the spaces): [ code ]RECT rcWorkArea[ /code ].
Topic archived. No new replies allowed.