I have a dialog box that should have a custom image as a background.
I do not have the whole image as a
bitmap
or any other format, so I have to draw it from scratch.
I use an
icon
( male in the left bottom of the screenshot) , one
EMF
file (the map on the screenshot below), and the rest consists of a green
gradient brush
, light gray
hatched brush
, and text - all being drawn using
GDI
. The result of my drawing looks like this (the screen shot includes the controls too):
http://pbrd.co/1m0fQpq[
^]
The problem I face manifests when I move the dialog box
to the left and then
move it back to its original position. The artifacts happening are illustrated at the bottom of the picture in the next screenshot:
http://pasteboard.co/2L0HMJBK.bmp[
^]
The dialog box is the
modeless one, and I draw the entire image in
WM_CTLCOLORDIALOG
returning
NULL_BRUSH
afterwards.
Here is the relevant code snippet for the
WM_CTLCOLORDIALOG
handler ( note that I
draw directly on the DC, there is
no double buffering. The reason for it is that
this was a quick test code things went wrong quickly):
http://pastebin.com/MKfUeH0N[
^]
To make this even more complete, I submit the
drawFooter
function and its helper functions:
http://pastebin.com/nbxQMW0u[
^]
Visual Styles are enabled - this might matter, I do not know.
I did not handle
WM_ERASEBKGND
nor
WM_SIZE
or
WM_MOVE
(
dialog box can not be resized. ). I have tried but it did not help ( returning
TRUE
for
WM_ERASEBKGND
, and
InvalidateRect
for
WM_SIZE
and
WM_MOVE
). I have found nothing on the internet to help me.
Question: How to change my code to fix the error I face?