Bitmaps as backgrounds

This is a discussion on Bitmaps as backgrounds within the Windows Programming forums, part of the Platform Specific Boards category; I need to know how to asign a bitmap as the background in a WNDCLASS I tries using a brush, ...

  1. #1
    monotonously living Dissata's Avatar
    Join Date
    Aug 2001
    Posts
    341

    Bitmaps as backgrounds

    I need to know how to asign a bitmap as the background in a WNDCLASS

    I tries using a brush, but I don't think I did it correctly. I don't remember exactly what I did but it was along the lines of

    Code:
    HANDLE hImage=LoadImage(NULL, "image.bmp",IMAGE_BITMAP, 0,0,LOADFROMFILE);
    
    LOGBRUSH MyBrush;
    MyBrush.lbStyle=BS_DIBPATTERN;
    MyBrush.lbHatch=CreateDIBSection(&hImage);
    
    HBRUSH hMyBrush=CreateBrushIndirect(&MyBrush);
    
    .
    .
    .
    
    wc.hbrBackground= MyBrush;
    any help on why this is wrong or any other techniques would be appreciated. I would have given you the actual code, except it's HIGHLY classified (it's on my laptop right now, and I'm to lazy to get it). maybe when I finish eh? I's actualy quite nifty!
    if a contradiction was contradicted would that contradition contradict the origional crontradiction?

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Just BitBlt() the bitmap to the entire client area

  3. #3
    monotonously living Dissata's Avatar
    Join Date
    Aug 2001
    Posts
    341
    I have that done right now, however, It hides any primitive drawings or text that I attempt to do over it.

    maybe I'm bitblt()ing in the wrong place?

    ::mutters to self::

    anyway, that for some reason made me think, I was bitblt()ing in the case WM_PAINT: or what not. maybe I should be bitBlt somewhere else so it doesn't redraw the bitmap again. I don't know.
    if a contradiction was contradicted would that contradition contradict the origional crontradiction?

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    It needs to be in the WM_PAINT message becuase that message is called everytime the program needs to validate a part of the client area. (for eg, another windows is placed over yours...)

  5. #5
    monotonously living Dissata's Avatar
    Join Date
    Aug 2001
    Posts
    341
    I know, this is what made me think I should assign a bitmap to a brush and set the background to draw that brush.
    if a contradiction was contradicted would that contradition contradict the origional crontradiction?

  6. #6
    monotonously living Dissata's Avatar
    Join Date
    Aug 2001
    Posts
    341
    bloody hell, I figured it out, I was trying to draw the primitives before I had destroyed the images DC. damn stupid logical errors.
    ::mutters to self::
    if a contradiction was contradicted would that contradition contradict the origional crontradiction?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing bitmaps efficiently
    By scwizzo in forum Windows Programming
    Replies: 28
    Last Post: 06-30-2009, 09:25 PM
  2. DX9 Not Displaying Bitmaps
    By Sentral in forum Game Programming
    Replies: 9
    Last Post: 01-31-2006, 05:35 AM
  3. MFC: Multiple clicks shows multiple bitmaps - how?
    By BrianK in forum Windows Programming
    Replies: 0
    Last Post: 06-20-2004, 08:25 PM
  4. using standard bitmaps in the toolbar editor
    By Kibble in forum Windows Programming
    Replies: 0
    Last Post: 12-23-2002, 08:43 PM
  5. Displaying bitmaps on a dialog
    By minesweeper in forum Windows Programming
    Replies: 2
    Last Post: 05-15-2002, 04:11 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21