Ownerdraw buttons (2)

This is a discussion on Ownerdraw buttons (2) within the Windows Programming forums, part of the Platform Specific Boards category; I have an other question about owner draw buttons. In my main window everything works fine, but when I use ...

  1. #1
    Banned maes's Avatar
    Join Date
    Aug 2001
    Posts
    744

    Ownerdraw buttons (2)

    I have an other question about owner draw buttons.
    In my main window everything works fine, but when I use ownerdraw buttons in a dialogbox, I have a huge bug.
    at first everything is fine, but when I move the dialobox with its body of the screen, or I put an other window on top, the buttons are gone, shouldn't windows end a WM_DRAWITEM whenever the buttons need to be repainted?

    or am I forgetting a function that call the WM_DRAWITEM?

    here's the code for WM_DRAWITEM
    Code:
    case WM_DRAWITEM :
    lpdis = (LPDRAWITEMSTRUCT) lParam; 
    hdcMem = CreateCompatibleDC(lpdis->hDC); 
    switch(lpdis->CtlID)
    {
    case IDC_PREV:
    SelectObject(hdcMem, hbmprev);
    StretchBlt(lpdis->hDC, lpdis->rcItem.left,lpdis->rcItem.top, 
    lpdis->rcItem.right - lpdis->rcItem.left, 
    lpdis->rcItem.bottom - lpdis->rcItem.top, 
    hdcMem,0, 0,47,50,SRCCOPY);
    return 0;
    ......
    }
    here is also a pic if I didn't make myself clear.
    the first one is after I put an other window in front of the dialogbox, the second one is the original:
    Attached Images Attached Images  
    Last edited by maes; 09-10-2003 at 10:52 PM.

  2. #2
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    Please edit your source code to change the StretchBlt() line into multiple shorter lines, so that the post is not two screen widths wide, which makes the post easily readable for everyone without scrolling.

  3. #3
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Who's still using 800x600??

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Me.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  5. #5
    Banned maes's Avatar
    Join Date
    Aug 2001
    Posts
    744
    your wish is my command
    done

    but no one knows the answer, or even a thought what the problem could be ?

    Or is there a ay that I can keep the dilogbox in memory so that it doesn't need a repain?

    Or is there a message that is send to the dlg that notifies a repaint (not specific the buttons) like WM_PAINT, so I can do a several sendmessage WM_DRAWITEM with the specific id of the button. Could this work (I'm going to try with a WM_PAINT but I have a feeling that I will end up in a loop)
    Last edited by maes; 09-10-2003 at 10:59 PM.

  6. #6
    Banned maes's Avatar
    Join Date
    Aug 2001
    Posts
    744
    Problem solved.
    guess what, I forgot to delete the hdc
    Code:
    DeleteDC(hdcMem);

  7. #7
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    Originally posted by BMJ
    Who's still using 800x600??
    About 1/3 of Internet surfers use 800x600, and about 1/2 use 1024x768. I personally use 1152x864. His post was not quite two screens wide, but anyone running less than 1600x1200 was forced to scroll to read it. It's too bad the code tags do not work like a table, so that the text outside of the code remains confined to the viewable screen, even if the code within the table is twice the width.

  8. #8
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Yea well... I figured you guys would be better than "most" people though

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 04-09-2009, 03:31 AM
  2. Ownerdraw buttons (again, I know)
    By maes in forum Windows Programming
    Replies: 2
    Last Post: 09-03-2003, 06:00 PM
  3. Radio Buttons in Visual C++ 6
    By Ripper1 in forum Windows Programming
    Replies: 22
    Last Post: 05-16-2003, 08:54 AM
  4. (Ken Fitlike) buttons
    By jdinger in forum C++ Programming
    Replies: 4
    Last Post: 03-15-2002, 01:21 PM
  5. Grouping radio buttons
    By Bazz in forum Windows Programming
    Replies: 1
    Last Post: 08-28-2001, 08:15 AM

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