[comp.windows.ms.programmer] icons and background color

Jeffrey.Perry@bbs.acs.unc.edu (Jeffrey Perry) (05/26/91)

I have a fairly simple problem. I am just learning to program in windows and
am having trouble getting windows not to erase the background to black before 
reploting icons in a 7x7 grid i have. I have tried setbkmode (transparent)
and setting hbackgnd to null for the window class of the grid window. neither
of these seem to work! What am i doing wrong!?

Thanks in advance for any help

--
   The opinions expressed are not necessarily those of the University of
     North Carolina at Chapel Hill, the Campus Office for Information
        Technology, or the Experimental Bulletin Board Service.
           internet:  bbs.oit.unc.edu or 128.109.157.30

bonneau@hyper.hyper.com (Paul Bonneau) (05/29/91)

In article <3926@beguine.UUCP> Jeffrey.Perry@bbs.acs.unc.edu
(Jeffrey Perry) writes:
>I have a fairly simple problem. I am just learning to program in windows and
>am having trouble getting windows not to erase the background to black before 
>reploting icons in a 7x7 grid i have. I have tried setbkmode (transparent)
>and setting hbackgnd to null for the window class of the grid window. neither
>of these seem to work! What am i doing wrong!?
>
I would guess one of two things.

Since you are using NULL for the background brush, you must
handle the WM_ERASEBKGND message.  Whether or not you
actually erase anything is totally up to you, but make sure
you return non-zero (and don't bother to call
DefWindowProc()).

If your "icons" are monochrome and you are using BitBlt() to
draw them, beware that the backgound color will be used for
white bits (1's), and foreground for black bits.  So you
might want to use SetBkColor() and SetTextColor() to get the
desired colors.

cheers - Paul Bonneau.