The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Don57 on October 20, 2011, 07:58:17 PM

Title: Displaying user messages on top of bitmapped graphic
Post by: Don57 on October 20, 2011, 07:58:17 PM
Still refining my encrypt program and I wish to display text on top of bitmapped graphics. I am trying to do this by leaving the graphics intact, and having just the text displayed. Any suggestions.
Title: Re: Displaying user messages on top of bitmapped graphic
Post by: dedndave on October 20, 2011, 08:58:17 PM
you can use a "hollow" or "null" brush as the background color when you paint the text
        INVOKE  GetStockObject,NULL_BRUSH
        INVOKE  SetBkColor,hDC,eax


or, you can use SetBkMode to set the background mode to transparent
        INVOKE  SetBkMode,hDC,TRANSPARENT

the first method is more flexible - you may want your paint routine to use various brushes
the second method is simpler, of course
Title: Re: Displaying user messages on top of bitmapped graphic
Post by: dedndave on October 20, 2011, 09:13:56 PM
oh - there is one other method....

when you register the window class, use a value of NULL (0) for the hbrBackground member of the WNDCLASSEX structure
this is essentially the same as using a null brush

when you do this, you will be responsible for filling (erasing) the background
Title: Re: Displaying user messages on top of bitmapped graphic
Post by: baltoro on October 20, 2011, 09:17:26 PM
TextOut function (http://msdn.microsoft.com/en-us/library/dd145133(v=vs.85).aspx)
What I usually do, is invoke all my graphic display functions in a code block, and then call InvalidateRect and UpdateWindow (http://msdn.microsoft.com/en-us/library/dd145167(v=vs.85).aspx)
See, also, Invalidating the Client Area (http://msdn.microsoft.com/en-us/library/dd145005(v=VS.85).aspx)