Results 1 to 13 of 13

Thread: change backcolor of a dialog

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115

    change backcolor of a dialog

    how to change the backcolor of a dialog?

    VIP
    ICQ :137108715
    MSN Messenger : [email protected]

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Try using SetWindowLong to set the background handle. Not sure if it will work, it just comes to my mind.

    Else you might want to catch the WM_ERASEBKGRND message
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    how to find the background handle?
    ICQ :137108715
    MSN Messenger : [email protected]

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    SetClassLong(hDlg, GCL_HBRBACKGROUND, hNewBrush);

    You must first create the new brush somehow.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    If I use a brush it gives the error:

    'Cannot convert parrameter 3 from CBrush to long'

    so I used RGB(0,0,0) but then the color of the dialog doesn't change. I places the code in the Paint function.

    what's wrong?
    ICQ :137108715
    MSN Messenger : [email protected]

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Use
    br.GetSafeHandle();

    And don't place the code in OnPaint but rather in OnCreate.

    I still can't guarantee it will work.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    it doesn't work
    ICQ :137108715
    MSN Messenger : [email protected]

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Search for CWnd::OnEraseBkgnd in the reference. This is what you need then.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    isn't in the list

    the dialog created with MFC is a CWnd Class? isn't it?

    VIP
    ICQ :137108715
    MSN Messenger : [email protected]

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    CDialog is derived from CWnd

    Search for WM_ERASEBKGND and then choose CWnd::OnEraseBkgnd from the popup window.

    Basically this function is called so you can erase the background of your window. Simply draw in whatever color you want to.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    I'm sorry, but it really isn't in the list, it goes from WM_DRAWITEM to WM_HELPINFO.
    ICQ :137108715
    MSN Messenger : [email protected]

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Download the newest SDK, you're misssing not only WM_ERASEBKGND but also
    WM_DROPFILES, WM_ENDSESSION, WM_ENTERIDLE and many others...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    which one? there are more than one.
    ICQ :137108715
    MSN Messenger : [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width