Results 1 to 4 of 4

Thread: best way

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Location
    Oak Park, IL, USA
    Posts
    43

    Question best way

    What is the best way to set a DC's background color?

    An api call made for it?

    Or do I have to get the RECT and FillRect first, then draw on top of that?

    Gregg

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    You can use this API
    SetBkColor
    The SetBkColor function sets the current background color to the specified color value, or to the nearest physical color if the device cannot represent the specified color value.

    COLORREF SetBkColor(
    HDC hdc, // handle of device context
    COLORREF crColor // background color value
    );

    Parameters
    hdc
    Handle to the device context.
    crColor
    Specifies the new background color.
    Return Values
    If the function succeeds, the return value specifies the previous background color as a COLORREF value.

    If the function fails, the return value is CLR_INVALID.

    Windows NT: To get extended error information, callGetLastError.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 1999
    Location
    Oak Park, IL, USA
    Posts
    43

    thanks

    thought this might help, but it doesnt solve my problem. argh im getting annoyed.

    Gregg

  4. #4
    Megatron
    Guest
    You have to subclass your window and capture the WM_CTLCOLORDLG messag first. Then you can call the function from there.

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